dotnet / dotnet/AspNetCore.Docs

Sample project about "Persist additional claims ..." does not work

Open
#29,499 0 comments 0 reactions 1 assignee Claimed by @halter73 View on GitHub
doc-enhancement re-Artak Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

There has a bug in the sample code that make the app cannot persist tokens.

The sample only instructs to persist tokens after logging in without being registered before.
https://github.com/dotnet/AspNetCore.Docs/blob/ce2f890e9c9af43bf542c0f6037edae9a0be406c/aspnetcore/security/authentication/social/additional-claims/samples/6.x/ClaimsSample/Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs#LL264C1-L272C18

The sample app enables the `RequireConfirmedAccount` option. As a result, `_signInManager.SignInAsync` cannot reach. It can work as expected if we disable it.
Or, we can update the `OnGetCallbackAsync` handler to persist tokens.

---
#### Document Details

⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*

* ID: 64faf33b-2511-5e8f-c1b0-94f32dc07fa4
* Version Independent ID: 2697abc8-7727-2eba-74a5-fbbc8a7c80ff
* Content: [Persist additional claims and tokens from external providers in ASP.NET Core](https://learn.microsoft.com/en-us/aspnet/core/security/authentication/social/additional-claims?view=aspnetcore-7.0)
* Content Source: [aspnetcore/security/authentication/social/additional-claims.md](https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/security/authentication/social/additional-claims.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-security**
* GitHub Login: @Rick-Anderson
* Microsoft Alias: **riande**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.