What causes IIdentityServerInteractionService.GetAllUserGrantsAsync() to return empty result? #170
Replies: 2 comments 14 replies
-
@gthvidsten you mentioned a database. That's a good place to start to see if the information for your session matches what is stored in the database. Here's the implementation of the public async Task<IEnumerable<Grant>> GetAllUserGrantsAsync()
{
using var activity = Tracing.ServiceActivitySource.StartActivity("DefaultIdentityServerInteractionService.GetAllUserGrants");
var user = await _userSession.GetUserAsync();
if (user != null)
{
var subject = user.GetSubjectId();
return await _grants.GetAllGrantsAsync(subject);
}
return Enumerable.Empty<Grant>();
} There are a few possible issues that could cause the grants to return an empty collection.
Setting a breakpoint and stepping through the code might help focus the search. |
Beta Was this translation helpful? Give feedback.
-
@khalidabuhakmeh Thanks for the reply. After debugging I can see that the user sessions is able to get the user. The user also has the correct SubjectId as returned from |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm experimenting with setting up a 3rd party login (Microsoft) to IdentityServer. This works just fine and I can log on, I can get tokens, and I can see the correct transformed claims.
However, the
IIdentityServerInteractionService.GetAllUserGrantsAsync()
doesn't return anything!The client is set up to not require consents (
RequireConsent = 0
in the database).The worst part is that this was working at some point and I don't know what I've done to make it stop working!
When I go back through my changes in my head I believe it stopped working when I added
.AddServerSideSessions()
but removing this doesn't make it work again. And I can't think of anything else I've done since it worked.So what have I done to make
.GetAllUserGrantsAsync()
to stop working?Here's my abbreviated code for the Microsoft callback URI which does the local sign in:
Beta Was this translation helpful? Give feedback.
All reactions