Comments (7)
respond with the status code inside the body
that's not it. i can see the JSON body :-( weird, you're also NOT doing and openid connect request, clearly you don't include the openid
scope.
from node-openid-client.
- discovered Issuer using
Issuer.discover('https://passport.twitch.tv').then((issuer) => { ... })
- set up a new client using
new issuer.Client({ client_id, client_secret, redirect_uris: [...], token_endpoint_auth_method: 'client_secret_post' });
- did an authorization request and response using the documented methods.
- I am getting a valid token set and validating it too.
TokenSet {
id_token: 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IjEifQ.eyJzdWIiOiIxMjUyMzQ4NTIiLCJpc3MiOiJodHRwczovL2FwaS50d2l0Y2gudHYvYXBpIiwiYXVkIjoidnA1dnJpMTdjOWY5YTc0eGlteXNhcHgyem43amVxIiwiZXhwIjoxNTA1NDIwNTY4LCJpYXQiOjE1MDU0MTk2Njh9.WP5EDO4u9DeW3Xi7cSJZrY9UxhXdZb9pjB0FENlHyHqWbzyuFQBKSOwXGdWC-6Tk5TJ2jX_ad--H5wRLcQSYO-aKUPIkQvDEre4dFNSvK_VR-HOU2HgNjJMHLYcdKjnue0hOtDn5e-fu9TwLlaQdryBEZ3YMsBW4kkaSfSFA3IDqCiYeLl6yF7ZnuCFmXxj19iU6dRdA2Hlg8AynymGm60XTrSlDW8w3IoQ6WuAphZZxvL8QRKsr_WoNRryOu2CfW8V0851R-mHCnhjqFd-VoBDUhJrsplbeqVA0MQwKaC26zcsbyvdxfRg3doCv2cZs85WRv880tl2vire_tZ1fuQ',
refresh_token: '...',
access_token: '...',
scope: 'openid',
expires_at: 1505434085 }
from node-openid-client.
can you paste your server code?
from node-openid-client.
Thanks for getting back to me, I set my client up manually:
const twitchIssuer = new Issuer({
issuer: 'https://api.twitch.tv',
authorization_endpoint: 'https://api.twitch.tv/kraken/oauth2/authorize',
token_endpoint: 'https://api.twitch.tv/api/oauth2/token',
userinfo_endpoint: 'https://api.twitch.tv/kraken/user',
jwks_uri: 'https://api.twitch.tv/api/oidc/keys'
});
const twitchClient = new twitchIssuer.Client({
client_id: ... ,
client_secret: ... ,
token_endpoint_auth_method: 'client_secret_post'
});
const twitchParams = {
redirect_uri: protocol + '//' + callbackHost + callbackPort + '/auth/twitch/callback',
scope: 'user_read user_follows_edit channel_check_subscription chat_login'
};
const passReqToCallback = true;
passport.use('twitchOIDC', new OIDCStrategy({ client: twitchClient, params: twitchParams, passReqToCallback: passReqToCallback }, (req, tokenset, userinfo, done) => {
console.log('tokenset', tokenset);
console.log('access_token', tokenset.access_token);
console.log('id_token', tokenset.id_token);
console.log('claims', tokenset.claims);
console.log('userinfo', userinfo);
// I don't have this in my code, I'm just interested in seeing the console output right now before incorporating the user model.
/*
models.User.findOne({ id: tokenset.claims.sub }, function (err, user) {
if (err) return done(err);
return done(null, user);
});*/
return done(err);
}));
from node-openid-client.
this is likely your problem
userinfo_endpoint: 'https://api.twitch.tv/kraken/user',
this is not where userinfo is, also you issuer identifier is incorrect to what twitch uses. just use discovery as in my example instead of setting up the issuer on your own. https://passport.twitch.tv/.well-known/openid-configuration
from node-openid-client.
not to mention that the userinfo endpoint twitch has does not work as it should according to the specification.
- remove userinfo from your callback arguments
- add openid to your list of requested scopes
- discover issuer
you will get your tokens then using this library
from node-openid-client.
Thank you for your help, I managed to receive a token using the discovery method without implementing the 'userinfo' argument.
from node-openid-client.
Related Issues (20)
- Always return an error saying please use an absolute URL HOT 1
- Low-level errors during `Issuer.discover()` cause error without stack trace
- OAuth 2.0 Device Authorization Grant (Device Flow) - poll without PKCE HOT 3
- Type checking httpOptions and rejectUnauthorized
- RPError thrown when IdToken JWE Header enc is blank HOT 2
- client won't run under `edge` runtime HOT 1
- Support setting client_secret to an empty string when using client_secret_basic or client_secret_post HOT 1
- Cannot assign to read only property 'dpopProof' of object '#<Client>' HOT 2
- Unsuccessful Callback to Unknow client side error HOT 10
- isKeyObject check fails in Bun HOT 5
- Scope delimiter replace problem HOT 2
- Multiple authenticate requests from the same session causes state mismatch HOT 1
- Can't authenticate when the server advertises authorization_response_iss_parameter_supported HOT 2
- Requests made without Accept-Encoding header HOT 1
- "cty" should not be included in jwks query HOT 2
- URL is not a constructor at Issuer.request HOT 1
- Application and Identity manger on different domains HOT 1
- Support other status code than 200 HOT 4
- Unable to use private_key_jwt auth method with Azure.
- Audience matching doesn't work as intended HOT 1
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 node-openid-client.