-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cannot authorize user when create or set up a tenant with Bearer token #2743
Comments
I believe this was a manifestation of #2727, which was just fixed. Do you mind giving it another try? |
Hi @PinpointTownes . I gave it a try without any success. |
What's the exact version you're referencing? Did you link the permission to the role after the access token was issued? |
If I know well, I do not need to create a user and enable any other endpoints, these steps should be necessary. Correct me if I'm wrong. |
Maybe this issue is related to mine: aspnet/Identity#1997
Then let's sign in the user with this ticket: Now let's authorize the user:
Let's the whats inside the User:
Let's see the Claims:
So for some reason the user has no claims at all after signing in. Weird. |
Fixed in this PR: #2872 |
I set up the Authorization server with the client credentials flow for my ASP.Net Core class library.
I added my app as an application with the Administrator client credential role (just for testing, to make sure).
Then I could get the Bearer token using the Token Endpoint.
The next step would be to create a tenant by calling the api/tenants/create endpoint.
You can find the following line in the Create method of the ApiController class in OrchardCore.Tenants.Controllers:
if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageTenants)) { return Unauthorized(); }
It's just a simple check to make sure that the currently logged in user has the ManageTenants permission, before doing anything.
The issue that I can't go through this authentication process, I always get the Unauthorized() result.
I found out that the the following line is missing from the Startup.cs of this module:
services.AddScoped<IPermissionProvider, Permissions>();
But adding this file to the flow and allow this permission didn't help me at all.
I tried to do the same with Postman. With Postman, I called the Authorize endpoint (connect/authorize) and got the token without any issue.
But I still cannot create or set up a tenant. I know this was possible before and it could be a new issue, but I have no further idea what could be the problem.
The text was updated successfully, but these errors were encountered: