Custom claims not in scope
See original GitHub issueQuestion 💬
I am using a custom provider like so:
{
id: "svipe",
name: "Svipe",
type: "oauth",
version: "2.0",
scope: "openid profile",
idToken: true,
params: { grant_type: "authorization_code" },
accessTokenUrl: "https://api.svipe.com/oidc/v1/token",
requestTokenUrl: "https://api.svipe.com/oidc/v1/authorize",
authorizationUrl: "https://api.svipe.com/oidc/v1/authorize?response_type=code",
profileUrl: "https://api.svipe.com/oidc/v1/userinfo",
async profile(profile, tokens) {
return {
id: profile.svipeid,
name: profile.name,
email: profile.email
}
},
clientId: process.env.SVIPE_ID,
clientSecret: process.env.SVIPE_SECRET
},
This is an OIDC provider and the configuration is here
Now, this provider has support for the common OIDC claims but also many custom such as passport document_number and such. How do I request this? Using passport and the openid-client strategy I would do this:
var params = {
claims: {
device_token: {essential: true},
issuing_country: {essential: true},
document_number: {essential: true},
birthdate: {essential: true},
person_number: {essential: true},
email: false,
phone: false,
given_name: {essential: true},
family_name: {essential: true},
portrait: {essential: true},
pkpass: req.session.pkpass
}
};
passport.use(
'oidc',
new Strategy({ client, params }, (tokenSet, userinfo, done) => {
var claims = tokenSet.claims();
claims.id_token = tokenSet.id_token;
return done(null, claims);
})
);
How can I do the same with NextAuth?
How to reproduce ☕️
Nothing to reproduce, this is a “how to” question.
Contributing 🙌🏽
Yes, I am willing to help answer this question in a PR
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Custom claims are not added in the token
I have written a rule to add a custom claim when retrieving the access token. The rule gets the claims from an external...
Read more >Custom Claims not present in access_token - Questions
Hi I am following this article in terms of creating a custom claim and getting that value back in the access_token.
Read more >c# - Custom claim not accessible in ...
by default custom claims will not be included in the User, instead you need to manually map the incoming claims that you care...
Read more >Control Access with Custom Claims and Security Rules
Best practices for custom claims Custom claims are only used to provide access control. They are not designed to store additional data (such...
Read more >What Are Scopes and Claims? A Short Overview
In the Curity Identity Server every claim the Server can issue will belong to a scope, but you can have scopes which do...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Cool. I actually solved it temporarily like this:
Awesome!