Set wireless mode before putting interface up. Put wireless interfaces up before trying to authenticate.