IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Duplicate scopes in JWT claims

Open asfyra opened this issue 9 years ago • 3 comments

I have created an ApiResource with a several Scopes:

new ApiResource { Name = "TestName", DisplayName = "Allow application to access your account", ApiSecrets = new List<Secret>{new Secret("scopeSecret".Sha256())}, Scopes = new List<Scope> { new Scope(Constants.Scope, "Allow application to access your account"){Required = true }, new Scope("ScopeA", "Allow application to make A"), new Scope("ScopeB", "Allow application to make B") } }

Now when a JWT is generated for a client that is allowed to request those two scopes, they are included twice in token claims

{ "nbf": 1496218768, "exp": 1496222368, "iss": "MyIdentityServer", "aud": [ "MyIdentityServer/resources", "customAPI", "TestName" ], "client_id": "TestWebApp", "sub": "375433", "auth_time": 1496218762, "idp": "local", "acr": "3ohqhanw43vr3f25f5xek0s1", "culture_name": "el-GR", "jti": "398f0a6b7e0f60551f39cba8324a36eb", "scope": [ "customAPI.read", "customAPI.write", "customAPI.read", "customAPI.write", "ScopeA", "ScopeB", "ScopeA", "ScopeB" ], "amr": [ "pwd" ] }

asfyra avatar May 31 '17 09:05 asfyra

Issue solved with this

asfyra avatar May 31 '17 09:05 asfyra

Thanks! You saved me some time there.

mosdevid avatar Aug 10 '17 17:08 mosdevid

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 14 '20 10:01 lock[bot]