Giter Club home page Giter Club logo

Comments (11)

Marren85 avatar Marren85 commented on June 30, 2024

I've downloaded the sample....doesn't work
Recreated from scratch adding the response type as code id_token to hit the AuthResponse...token is null

WHY IS IT NULL!!

What is that has changed between 1.1 and 2.0 that makes the access token null?

It will something so simple and for the life of me I can't see it...

Readded the variables to the 1.1 sample and works perfectly first time...why not in 2.0?

from active-directory-b2c-dotnetcore-webapp.

chaimzf avatar chaimzf commented on June 30, 2024

For .net Core 2.0 use this sample:
https://github.com/Azure-Samples/active-directory-b2c-dotnetcore-webapp/blob/core2.0/WebApp-OpenIDConnect-DotNet/OpenIdConnectOptionsSetup.cs

from active-directory-b2c-dotnetcore-webapp.

Marren85 avatar Marren85 commented on June 30, 2024

Hi chaimzf, I did use the 2.0 branch. As I said in the first post, it doesnt work.

The 1.1 branch works perfectly.
The 2.0 branch does not.

AuthcodeRecv is never hit in the 2.0 branch,

2.0 branch needs adjusting to have a requesttype of code id_token to hit the AuthCodeRecv.

Within the 2.0 branch AuthCodeRecv event, in the MSAL request respone, the token is always null...

from active-directory-b2c-dotnetcore-webapp.

Marren85 avatar Marren85 commented on June 30, 2024

I've spent so much time on this, its not even funny!

So, I went back to the 1.1 branch, which we know works..I manually upgraded to 2.0 so a lot of the code stays the same (which we know works)...Tested...null token.

To play safe, I completely removed the AzureB2CExtensions and added the bare minimum to Startup to make Azure B2C work with OpenIDConnect and used the 1.1 branch OnAuthCodeRecv which we know works...null token.

from active-directory-b2c-dotnetcore-webapp.

jg11jg avatar jg11jg commented on June 30, 2024

probably this doesn't give you much help but I can confirm that it was the other way round for me. 1.1 branch didnt' work, 2.0 branch works just fine, i can log in using social provider, log out etc. With zero changes to source code.

from active-directory-b2c-dotnetcore-webapp.

Marren85 avatar Marren85 commented on June 30, 2024

Hi @jg11jg the logging in is a separate concern, ironically that works in both 1.1 and 2.0 branches, the MSAL token is a separate request which doesn't effect the logging in process.

I just cant believe after all this time, this still doesn't work, I've been following this for over a year

from active-directory-b2c-dotnetcore-webapp.

parakhj avatar parakhj commented on June 30, 2024

@Marren85 When you say "MSAL token", are you referring to an access token?

from active-directory-b2c-dotnetcore-webapp.

Marren85 avatar Marren85 commented on June 30, 2024

@parakhj I am

from active-directory-b2c-dotnetcore-webapp.

parakhj avatar parakhj commented on June 30, 2024

Could you send me the request that you are making? Fiddler or Chrome might be useful to capture it, or you can set up a debugger.

The scope that is being sent is likely incorrect, so just want to confirm.

from active-directory-b2c-dotnetcore-webapp.

Marren85 avatar Marren85 commented on June 30, 2024

@parakhj its the exact same scope that successfully generates a token in the 1.1 branch, its just for an API with a published scope in my B2C tenant.

If there was a problem with the scope, it wouldn't get the token in the 1.1 branch surely?

1.1 Branch
1-1 branch

2.0 Branch
2-0 branch

Your caching issue is interesting I'm going to delete everything and recreate

from active-directory-b2c-dotnetcore-webapp.

Marren85 avatar Marren85 commented on June 30, 2024

Fixed It!

How you may ask...I have no idea but I will run through the steps for anyone else having the same problem...

All in Azure...firstly delete your WebApp and API from the Applications in the B2C blade.

Recreate the WebApp and API, remembering to add Published Scopes to the API and API Access to the WebApp, you can use the same scopes from the code you already have.

In your code you will need to update the variables which have changed (ClientID, Secret)

That's it, for whatever reason it works! Whatever the problem was it was on the Azure end and I have no idea what that might be!

So to sum up, I've ended up with the same Azure settings I had before, the same code I had before but now it works!

Seen as you've already updates the code to add the ResponseType to hit the AuthCodeRecv like I said, this can be closed!

from active-directory-b2c-dotnetcore-webapp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.