[Aerogear-users] OAuth2 session doesn't persist in iOS

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Aerogear-users] OAuth2 session doesn't persist in iOS

Michael Doo

When integrating the Aerogear iOS OAuth2 library, I'm adding an account like so:

let googleModule = AccountManager.addGoogleAccount(googleConfig)

In the current session, I can then make calls like

let module = AccountManager.getAccountByName("my_custom_account_name")

and retrieve the module to call requestAccess() on and go on with my day. However, if I stop the app or restart the device, the following calls to getAccountByName() returns nil, even when given the same account ID. From the documentation, it's unclear how to persist accounts in the account manager across sessions. Do I need to resurrect the session somehow or reinstantiate it? Or am I missing how AccountManager interacts with the TrustedPersistantOAuth2Session? My goal is to simply be able to authorize multiple Gmail accounts and refresh their access tokens when needed. The AccountManager seemed a good way to do this, but I could be mistaken.

Michael Doo

Aerogear-users mailing list
[hidden email]