Forums

M Mrudula
visibility 43
thumb_up 0
comment 1
access_time 6 months ago
more_vert
J jean-philippe
visibility 71
thumb_up 0
comment 1
access_time 6 months ago
more_vert
A ameni
chat_bubble_outline Haddop API
visibility 51
thumb_up 0
comment 3
access_time 7 months ago
more_vert
A Andrey
chat_bubble_outline HBase replication
visibility 46
thumb_up 0
comment 3
access_time 9 months ago
more_vert
R Royer
visibility 550
thumb_up 0
comment 4
access_time 10 months ago
more_vert
L luc
visibility 62
thumb_up 0
comment 3
access_time 11 months ago
more_vert
R RAVULA
visibility 34
thumb_up 0
comment 6
access_time 11 months ago
more_vert
Kontext Kontext
visibility 213
thumb_up 0
comment 0
access_time 2 years ago
more_vert
S Surendiran
visibility 1546
thumb_up 0
comment 1
access_time 2 years ago
more_vert
D Daniel
visibility 977
thumb_up 0
comment 3
access_time 2 years ago
more_vert
Raymond Raymond
#1873 Re: ASP.NET Core - Implement Google One Tap Sign In access_time10 days ago

Hi Rami,

You can use UserManager class in Identity to retrieve the user information defined in your own ApplicationUser class.

UserManager<TUser>.GetUserAsync(ClaimsPrincipal) Method (Microsoft.AspNetCore.Identity) | Microsoft Learn

For parameter principal it is available in Razor page or MVC Controller class directly after the user is authenticated.

RT Rami Taher
#1872 Re: ASP.NET Core - Implement Google One Tap Sign In access_time11 days ago

its saved in the default user identity table. I have the below code with no errors but no photo shown.


<div class="profile-wrapper">

<img src="@User.FindFirst("PictureSource")?.Value" class="profile" />

<div class="titles d-flex flex-column ps-3">

<h6 class="mb-0">Expense Tracher</h6>

<span class="text-muted">Logged In</span>

</div>

</div>

Raymond Raymond
#1871 Re: ASP.NET Core - Implement Google One Tap Sign In access_time11 days ago

Hi Rami, depends on where you save the photo attribute to, you just need to query it from the store. You can use entity framework for this. 

RT Rami Taher
#1870 Re: ASP.NET Core - Implement Google One Tap Sign In access_time12 days ago

Hi,


I managed to save the path in the DB but now in my sidebar how to get the path from the db into the img field below:


<img class="profile-pic" src="~/profile2.jpg" />
 @* change based on login *@ 
 @if (!SignInManager.IsSignedIn(User))
 {
     <div class="profile-wrapper">
         <img class="profile-pic" src="~/profile.jpg" />
     
         <div class="titles d-flex flex-column ps-3">
             <h6 class="mb-0">Expense Tracher</h6>
             <span class="text-muted">Guest</span>
             <a href="/">Please Login</a>
         </div>
     </div>
 }
 else
 {
     
     <div class="profile-wrapper">
         <img class="profile-pic" src="~/profile2.jpg" />

         <div class="titles d-flex flex-column ps-3">
             <h6 class="mb-0">Expense Tracher</h6>
             <span class="text-muted">Logged In</span>
         </div>
     </div>
 }
Raymond Raymond
#1869 Re: ASP.NET Core - Implement Google One Tap Sign In access_time12 days ago

Yes, photo is included in the response JWT token payload:

https://cloud.google.com/dotnet/docs/reference/Google.Apis/latest/Google.Apis.Auth.GoogleJsonWebSignature.Payload#Google_Apis_Auth_GoogleJsonWebSignature_Payload_Picture


GoogleJsonWebSignature.Payload.Picture



RT Rami Taher
#1868 Re: ASP.NET Core - Implement Google One Tap Sign In access_time13 days ago

Hi Again Raymond,


I came up with a question. Is there a way to get the profile photo from google using the payload?

Raymond Raymond
#1867 Re: Visual Studio Code: Debug ASP.NET Application with Hot Reload access_time15 days ago

Thanks for the info. I will also try the extension.

F Firstname
#1866 Re: Visual Studio Code: Debug ASP.NET Application with Hot Reload access_time16 days ago

I found this extension which seems to work as expected:

https://github.com/Trottero/dotnet-watch-attach


Would love to see it nativley supported by VS code though. There is an open issue for it:

https://github.com/dotnet/vscode-csharp/issues/4822

Raymond Raymond
#1865 Re: ASP.NET Core - Implement Google One Tap Sign In access_time16 days ago

You are welcome. I am glad it now works for you.

RT Rami Taher
#1864 Re: ASP.NET Core - Implement Google One Tap Sign In access_time16 days ago

Thanks alot for helping me out. I finally managed to do it.


private readonly SignInManager<IdentityUser> _signManager;

private readonly UserManager<IdentityUser> _userManager;

public HomeController(UserManager<IdentityUser> userManager, SignInManager<IdentityUser> signManager)

{

_userManager = userManager;

_signManager = signManager;

}


and in my function:


var user = new IdentityUser { UserName = payload.Email, Email = payload.Email };

await _userManager.CreateAsync(user).ConfigureAwait(false);

await _signManager.SignInAsync(user, isPersistent: false).ConfigureAwait(false);

return RedirectToAction("Index","Category");