completed code to request token