How do I get Android AccountManager and ASP.NET WebAPI to use default Google authentication for collaboration?

I have an MVAP 5 WebAPI project using Google's external authentication (the default value means that I just uncommented app.Usegoogle ... in the Startup class).

From my Android app, I want to authenticate to my website without prompting the user to log in to Google, simply selecting an account from their existing accounts.

I could call the GetExternalLogin method in my WebAPI and then redirect me to google, log in to the webview and let the average OWIN wear do its job. But I want to use existing accounts on the device.

Using AccountManager.getAuthToken I can directly get the access token. But how can I use this for authentication using the same GetExternalLogin method?

Another option would be to create a new method on my APIController to get the access token that is sent from my Android application, and then make a google api call to get its identity, and then somehow use the Usermanager to sign the user by default?

+3
source share

All Articles