OAuth credentials are saved in Simulator but not on Phone

Former Member
Former Member
Hello,

i have trouble with one thing. I've implemented a OAuth flow and everything works fine in Simulator, it saved my Username and Password, even days later it reconnects fine.
But if i try it on my watch and phone and the tokens have expired, my phone asks me to login again and does not remember the Username and Password. So login screen opens but i have to retype my credentials every time on my phone.

Any suggestion what to do here? Is this a problem with the used server and service? Or should i tell the connect IQ app somehow to save the credentials in Garmin Connect or so expectedly?

Thanks

Mike
  • The OAuth flow does not intentionally save your username and password for you.

    Assuming you're using an OAuth2 flow, it works something like this...
    • You call Communications.registerForOAuthMessages() to register a function to be called when an OAuth response code is sent to your application
    • You call Communications.makeOAuthRequest() to request an authorization code
    • You will see a notification on your mobile phone to login, and sign in via the authorization form
    • The server responds with an authorization code
    • The method registered in step 1 is called, and the authorization code is passed as a parameter
    • You call Communications.makeWebRequest() to request an access token, passing the given authorization code with the request
    • The server responds with an access token, and possibly a refresh token and information about how long the access token is valid
    • You save the tokens
    Once you have the tokens..
    • You supply the access token with requests that require authentication
    • You use the refresh token (if any) to refresh the access token if it expires
    Travis