1

In Facebook, I can get user photo by using user id, like this:

var info = await AuthenticationManager.GetExternalLoginInfoAsync();

string pictureUrl = "https://graph.facebook.com/" + info.Login.ProviderKey + "/picture?type=large";

Is it possible in Google? If possible, can you give me the url which I can get user photo with ProviderKey?

something's like:

string pictureUrl = "https://google.com/" + info.Login.ProviderKey + "/picture?type=large";

Thank you!

2 Answers2

1

No, you have to use the https://www.googleapis.com/plus/v1/people/me endpoint and pass a bearer token which is just the access token provided during the OAuth login.

See: https://developers.google.com/+/web/api/rest/latest/people/get

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
1

If you are using the newer auth endpoints (v2/auth and v4/token as referenced in the discovery document) and request the profile scope in your auth request, the returned ID Token will include user photo in the picture claim, for users that have one. This question has more info.

Community
  • 1
  • 1
William Denniss
  • 16,089
  • 7
  • 81
  • 124