I am a fresh developer on Googles Android Platform - my HTC Desire arrived last week.
Now i need a way to sign in to my existing application (Java, currently running on jetty). The server Application is developed using spring security 3.0.2
In my case, i want to support the following: If a user has set up his Android phone with a googlemail/google-Account (and most users do) i want to use this account credentials to automagically log in to my server app.
Is there any Android framework supporting that use-case? Or are there any alternatives?
I read: http code.google.com intl/de-DE/apis/accounts/docs/OpenID.html
How we do sign in with an app on google AppEngine is described here: http://blog.notdot.net/2010/05/Authenticating-against-App-Engine-from-an-Android-app
With OpenID, your password is only given to your identity provider, and that provider then confirms your identity to the websites you visit. Other than your provider, no website ever sees your password, so you don't need to worry about an unscrupulous or insecure website compromising your identity.
OneLogin provides a complete user identification and authentication solution that gives you the ability to configure your app and create and manage your user accounts, all while being easy to add to your Android apps.
OpenID Connect Single Sign-On (SSO) OpenID Connect (OIDC) is a protocol to verify user identities and get user profile information. OIDC enables devices to verify identities based on authentication done by an authentication server.
OpenID Connect allows for clients of all types, including browser-based JavaScript and native mobile apps, to launch sign-in flows and receive verifiable assertions about the identity of signed-in users.
I think what you want is to use AccountManager
To find out what type the google account is, use something like:
AuthenticatorDescription[] types = mAccountManager.getAuthenticatorTypes(); //
for (AuthenticatorDescription type : types) {
Log.d("account types", type.type);
}
Then do something like
AccountManager mAccountManager = AccountManager.get(context);
Account[] mAccounts = AccountManager.get(context).getAccountsByType("com.google");
// Choose which account to use if there are multiple google accounts registered, save to Account mAccount
AccountManagerFuture<options> response = mAccountManager.getAuthToken(mAccount, type, options, activity, mCallback, mHandler); // define callback and handler yourself for where to return
When the user reaches mCallback in your mHandler, the login process is done. The usual google login dialogue will be used if the user is not already logged in to his/her Google account.
Try it out for yourself and let me know if it helped you!
Here is an OPENID java API : Here is the link:http://code.google.com/p/openid4java/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With