Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor WASM AADB2C template fetchdata failed due to The issuer '(null)' is invalid #39401

Closed
1 task done
Alienroid opened this issue Jan 10, 2022 · 11 comments
Closed
1 task done
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-wasm-auth

Comments

@Alienroid
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Blazor WASM AADB2C template's fetchdata will fail after enter credentials. The error shows 401 Unauthorized in the console. Look at the requests. ID token and Access token were received with correct scp. The response header shows www-authenticate: Bearer error="invalid_token", error_description="The issuer '(null)' is invalid". However the issuer is present in the request and not null.

One thing I did observe, in the documentation
it shows: "iss": "https://mysiteb2c.b2clogin.com/5cc15ea8-a296-4aa3-97e4-226dcc9ad298/v2.0/",

however, the one I received in the id token is like:
"iss": "https://mysiteb2c.b2clogin.com/tfp/[guid]/b2c_1_signin_signup/v2.0/",

Expected Behavior

Able to access the data requested

Steps To Reproduce

  1. follow instructions from https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-azure-active-directory-b2c?view=aspnetcore-6.0
  2. run the app
  3. click on Fetch Data
  4. enter credentials
  5. call will fail. inspect to see that it received 401 unauthorized. on network tab, it shows received both id token and access token. look at the request it shows response header: www-authenticate: Bearer error="invalid_token", error_description="The issuer '(null)' is invalid"

Exceptions (if any)

No response

.NET Version

6.0.0

Anything else?

No response

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-wasm-auth labels Jan 10, 2022
@javiercn javiercn added this to the Backlog milestone Jan 10, 2022
@ghost
Copy link

ghost commented Jan 10, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@guardrex
Copy link
Contributor

The docs have been updated for ASP.NET Core 6.0 but not necessarily for Microsoft Identity Platform changes that would only call for doc updates to address. Walking the guidance with 6.0 test apps is scheduled for 22H1. @javiercn, let me know if you'd like me to see if I can repro @Alienroid's report. 👂 If so, I'll get back to you within a day or two.

@Alienroid
Copy link
Author

Alienroid commented Jan 10, 2022 via email

@guardrex
Copy link
Contributor

I don't think that's it. I checked my last working config (5.0-era), and it's ...

"accessTokenAcceptedVersion": 2,

@Alienroid
Copy link
Author

ok. I am just suspecting it because it's an iss issue and looks like in the document is at https://.b2clogin.com/775527ff-9a37-4307-8b3d-cc311f58d925/v2.0/ and what I got was "https://.b2clogin.com/tfp/[guid]/b2c_1_signin_signup/v2.0/",

@guardrex
Copy link
Contributor

guardrex commented Jan 10, 2022

Just the .b2clogin.com alone looks like a botched app generation. Nevermind ... I see that you cited earlier mysiteb2c. .... Anyway ... Did you use the CLI (as the topic shows) or did you use VS's built-in New Project gesture with ✨ magical Azure config ✨? ... and/or did you compare the server and client config from the topic to your app ... are you saying the config (the two appsettings.json files) is exactly the same?

@Alienroid
Copy link
Author

Alienroid commented Jan 10, 2022 via email

@guardrex
Copy link
Contributor

Ok. I'll stand-by to hear from Javier if he thinks that I should walk the topic and try to repro what you're seeing. There was a problem with VS 2017 generating the right config, and I haven't confirmed yet if VS 2022 works correctly. That's part of the planned updates to the guidance, if we continue to maintain it given that Azure docs now have versions of some of these scenarios.

@Alienroid
Copy link
Author

Alienroid commented Jan 10, 2022 via email

@Alienroid
Copy link
Author

Alienroid commented Jan 11, 2022 via email

@MackinnonBuck
Copy link
Member

Closing this out. Glad you were able to solve the problem!

@MackinnonBuck MackinnonBuck closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly feature-blazor-wasm-auth
Projects
None yet
Development

No branches or pull requests

5 participants