I have a spring oauth2 server in my backend which issues the access and refresh token when a user login request comes with the client and user credentials.Now i want to connect to this oauth2 server from my android application using the Account manager in android.I have searched a lot for that but found everything that connect to google auth server using google api.How can i connect to my own oauth server using this account manager and can retrieve the token and can handle the token expiry and password change.Somebody please help me to solve this.
1 Answers
Check this tutorial, maybe offer you the answer:
http://blog.udinic.com/2013/04/24/write-your-own-android-authenticator/
"First time logging-in
The app asks the AccountManager for an auth-token.
The AccountManager asks the relevant AccountAuthenticator if it has a token for us.
Since it has none (there’s no logged-in user), it show us a AccountAuthenticatorActivity that will allow the user to log-in.
The user logs-in and auth-token is returned from the server.
The auth-token is stored for future use in the AccountManager.
The app gets the auth-token it requested
Everyone’s happy!
In case the user has already logged-in, we would get the auth-token back already on the second step. You can read more about authenticating using OAuth2 here."
I found this article looking for exactly the same problem.