Comments (11)
Please note, I saw this when I forgot the trailing /, for the api:ApiIdentifier.
.. key="api:ApiIdentifier" value="https://forexample.onmicrosoft.com/myapi"
Must be
.. key="api:ApiIdentifier" value="https://forexample.onmicrosoft.com/myapi/"
Since the scopes are created by appending the security token, I was getting myapiread, as opposed to myapi/read in the code example.
from active-directory-b2c-dotnet-webapp-and-webapi.
Not sure what message you are seeing. Could you repaste it?
Yes, you will need to make changes to your TaskService Web Config. You need to update it with your B2C configuration (e.g. the client ID of the Web API app registration, your tenant name)
from active-directory-b2c-dotnet-webapp-and-webapi.
@parakhj The Error-message I get is in the title :) Or did you mean something else?
Okay, but in the walktrough where you link to this GitHub project there is nothing about modifying the TaskService Web Config? Or did I miss it?
from active-directory-b2c-dotnet-webapp-and-webapi.
There are multiple pages linking to this repo, depending on what you are trying to achieve. Check out the readme of this repo
from active-directory-b2c-dotnet-webapp-and-webapi.
@MrCharli3 Hello! 👋 I just made some updates to the readme earlier today that show step-by-step how to register both apps (the web app and the web api) in the Azure portal and how to configure both VS projects (i.e. the sample apps available in the solution in this repo) to use your tenant.
Please take a look and let us know if you still have any questions! Thanks!
from active-directory-b2c-dotnet-webapp-and-webapi.
@dblaszyk Thanks for calling this out! I've added a quick 📝 in the readme to verify that the trailing /
has been added to the ApiIdentifier
.
from active-directory-b2c-dotnet-webapp-and-webapi.
I followed all the instructions but when i try to access the to-do-list it gives this error
Error. We're having trouble signing you in. Please sign in again. Unauthorized
Although i am already signed in. Kindly see the attached code below:
<configuration>
<appSettings>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<add key="ida:Tenant" value="kardexlcs.onmicrosoft.com"/>
<add key="ida:ClientId" value="5d4bede7-8874-4e2d-8628-aeb62fb102a7"/>
<add key="ida:ClientSecret" value="-removed-"/>
<add key="ida:AadInstance" value="https://login.microsoftonline.com/tfp/{0}/{1}/v2.0/.well-known/openid-configuration"/>
<add key="ida:RedirectUri" value="https://localhost:44316/"/>
<add key="ida:SignUpSignInPolicyId" value="B2C_1_SiupIN"/>
<add key="ida:EditProfilePolicyId" value="B2C_1_Sipe"/>
<add key="ida:ResetPasswordPolicyId" value="B2C_1_SSPR"/>
<add key="api:TaskServiceUrl" value="https://localhost:44332/"/>
<!-- Uncomment the localhost url if you want to run the API locally -->
<!--add key="api:TaskServiceUrl" value="https://localhost:44332/" /-->
<!-- The following settings is used for requesting access tokens -->
<add key="api:ApiIdentifier" value="https://kardexlcs.onmicrosoft.com/tasks/"/>
<add key="api:ReadScope" value="Hello.read"/>
<add key="api:WriteScope" value="Hello.write"/>
</appSettings>
Am i missing something in the configuration??
Any help would be highly appreciated.
Thanks in advance.
from active-directory-b2c-dotnet-webapp-and-webapi.
Please, re-open if this is happening in the latest version of this sample
from active-directory-b2c-dotnet-webapp-and-webapi.
Hello,
It seems I am also having the same issue with the lastest documentation.
I've followed the tutorial (https://docs.microsoft.com/en-ca/azure/active-directory-b2c/tutorial-web-api-dotnet?tabs=app-reg-preview) and when I am trying to access the ToDoList, I have :
"We're having trouble signing you in.
Please sign in again. Unauthorized"
After some investigation, it seems that var accounts = await cca.GetAccountAsync(); returns 0 account the first time, it's called. After that, it goes to:
==> return new RedirectResult("/Account/SignUpSignIn?redirectUrl=/Tasks");
Then, it goes again in the Index method and this time there is one account and the UserName is "
It seems that in the TaskController.cs, when I am trying to get the token (even if I am already signin), I get a null AccessToken.
from active-directory-b2c-dotnet-webapp-and-webapi.
I have followed the same documentation. https://docs.microsoft.com/en-ca/azure/active-directory-b2c/tutorial-web-api-dotnet?tabs=app-reg-ga
I'm successfully login into WebApp.
But getting the issue while accessing the API.
Error.
We're having trouble signing you in.
Please sign in again. Unauthorized
Also, I have granted both web app and well as API from Azure AD B2C.
Any help would be highly appreciated.
Thanks in advance.
from active-directory-b2c-dotnet-webapp-and-webapi.
I had same issue - I went to the WebApp app registration and needed to grant admin consent - before I did the status said something else and was not green. otherwise put a breakpoint in TasksController.Index() when it calls cca.AcquireTokenSilent - does result.AccessToken have a value? it was null for me until I made the change below. hope this helps.
from active-directory-b2c-dotnet-webapp-and-webapi.
Related Issues (20)
- make the sample code work behind organization proxy HOT 2
- App very old - Do you have once that works? HOT 7
- Cannot create SSL/TLS link when retrieving metadata HOT 9
- No account or login hint was passed to the AcquireTokenSilent call HOT 12
- Could not load file or assembly Microsoft.Identity.Client, Version=4.37.0.0 HOT 1
- Sign up / Sign in failed HOT 4
- Upgrade to .NET 6 for macOS HOT 3
- Why we need `ReaderWriterLockSlim` in OpenIdConnectCachingSecurityTokenProvider?
- Metadata Endpoint Url cannot be accessed from the sample code
- Bad Request open two tabs with the same web HOT 1
- HttpContext.GetOwinContext().Get<string>("Policy") is a global setting, not a per user session setting HOT 1
- How to use MSAL in this example to do refresh token from azure ad b2c?
- Instructions for configuration back end (.NET web API Project) on AppService is not clear as per the documentation
- How to access "ID token"/"claims" in Web Controllers? HOT 5
- Azure AD B2C - .NET-Web app calling web api - No account or login hint was passed to the AcquireTokenSilent call HOT 21
- Startup Error IDX20807: Unable to retrieve document from: 'System.String' / TLS 1.2 HOT 2
- Implicit grant
- Nuget package Owin.1.0.1 can not be found HOT 1
- Redirect results in 404.
- The demo project is out of date for decade, can we have the latest .NET 8 version? HOT 9
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-dotnet-webapp-and-webapi.