1

I am using Azure mobile services to store data from my Android app. Users have to log in using Google and I've used Azure's Easy Auth to implement that.

However, I also need the display name and the email of the user. I have searched a lot and couldn't find a way how to get the info. I know that for other providers like Facebook or Microsoft you can just check attributes that should be included in the response (e.g. Microsoft as provider) but with Google, Azure doesn't provide any attributes.

f.k
  • 85
  • 2
  • 9

1 Answers1

2

I just followed How to configure your App Service application to use Google login to configure my App Service Authentication (Easy Auth) for Google login. I just leverage the Server-managed authentication and log with my mobile app backend via the browser as follows:

GET https://<your-app-name>.azurewebsites.net/.auth/login/google

Using fiddler to capture the network traces as follows:

enter image description here

Then, access the /.auth/me endpoint via the browser, I could retrieve the user email as follows:

enter image description here

Moreover, you could follow Obtaining user profile information. Also, you could access https://www.googleapis.com/oauth2/v1/userinfo?access_token=<access_token> to retrieve the user profile manually.

Additionally, if you want to modify the google OAuth Scopes (set googleOAuthScopes array property via https://resources.azure.com) or retrieve the refresh token (access_type=offline), you could follow this similar issue. And you could follow App Service Token Store for more details about App Service Authentication.

Bruce Chen
  • 18,207
  • 2
  • 21
  • 35