How do i get the users profile picture when using ASP.NET CORE Google Auth?
Im using this package: https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Google/
In my login controller, I have some of the following code:
claims object contains 5 properties , that have the email, firstname, lastname, etc. but it doesnt have the link for the user profile picture. I'm trying to figure out how to get the users profile picture while logging in. Is there a way i can do that?
Microsoft.AspNetCore.Authentication.Google 8.0.1
ASP.NET Core contains middleware to support Google's OpenId and OAuth 2.0 authentication workflows.
This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/8e941eb42f819adb116b881195158b3887a70a1c
6 Replies
this is the full login controller: https://github.com/ForkEyeee/realtime-poll/blob/main/realTimePollsApp/Controllers/LoginController.cs
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
hkm ok i was looking into it seem a bit complicated than i thought
maybe i wont bother then, cause i remember i was doing it in a previous project and it was super easy to do, i thought it would be the same here
as far as I understand u need to add GoogleOptions with the scope needed for the pfp
https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.authentication.google.googleoptions?view=aspnetcore-8.0
there is an example on this one using claims
https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/additional-claims?view=aspnetcore-8.0
if you already have the scope try
ah i think that actually worked lol. i added to program.cs and that was all i needed
yea i put the link in a new tab and its my pfp. so thanks guys