Comments (11)
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.
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.
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.
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.
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.
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.
@Marren85 When you say "MSAL token", are you referring to an access token?
from active-directory-b2c-dotnetcore-webapp.
@parakhj I am
from active-directory-b2c-dotnetcore-webapp.
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.
@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?
Your caching issue is interesting I'm going to delete everything and recreate
from active-directory-b2c-dotnetcore-webapp.
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)
- got secure error when I try to sign in HOT 2
- Not compatible with aspnet core 2.1 HOT 1
- Error from RemoteAuthentication: Message contains error: 'redirect_uri_mismatch', error_description: 'AADB2C90006: The redirect URI 'http://b2.95e4700435c54427a457.northeurope.aksapp.io/signin-oidc' provided in the request is not registered for the client id 'eb201049-e7b1-4227-9a7c-5bb259261d37'. Correlation ID: 8f75359e-009f-44e3-b537-3f85f58cdd9c HOT 6
- User.Identity.Name is null and HttpContext.User.Claims is empty HOT 6
- ERROR Account username: Missing from the token response environment login.microsoftonline.com home account id: AccountId: XXXX HOT 8
- Single-Sign Out AD B2C HOT 2
- NullReferenceException in MSALSessionCache constructor HOT 1
- acquireTokenSilent sometimes returns a null accesstoken HOT 1
- Error messages in OnRemoteFailure should be url encoded before appending to query string HOT 3
- Latest version of AAD B2C? HOT 2
- Update the repository to not use Bower HOT 3
- Update the repository to use the latest MSAL version HOT 2
- b2clogin.com for ASP.NET Core HOT 7
- No accounts being returned on cca.GetAccountsAsync()
- Words 'simple' and 'dead simple' should be removed from content. HOT 1
- Unit testing for SessionController HOT 1
- Compatibility with .NET Core 3.1 HOT 2
- How do I diagnose errors? HOT 1
- How to pass domain_hint while calling B2C for login HOT 1
- How to select a policy at runtime?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from active-directory-b2c-dotnetcore-webapp.