I am trying to use Passport to connect to Office365. I get an auth prompt and an access token is returned. The problem is that the update token is undefined.
My setting
const creds = {
redirectUrl: 'http://localhost:3000/token',
clientID: '<myClientId>',
clientSecret: '<mySecret>',
identityMetadata: 'https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration',
allowHttpForRedirectUrl: true,
accessType: 'offline',
responseType: 'code',
validateIssuer: false,
responseMode: 'query',
scope: [
'Contacts.Read',
...
]
};
const callback = (iss, sub, profile, accessToken, refreshToken, done) => {
console.log('Refresh Token: ', refreshToken);
done(null, {
profile,
accessToken,
refreshToken
});
};
passport.use(new OIDCStrategy(creds, callback));
const passportSettings = {
accessType: 'offline',
approvalPrompt: 'consent'
};
router.get('/login', (req, res, next) => {
passport.authenticate('azuread-openidconnect', passportSettings, (err, user, info) => {
});
});
Things I tried:
- Cancel authorization of the application for the user with whom I subscribed.
- Moving the location of the parameter
accessType.
I am really at a loss why this is not working. In Google’s strategy, simply set the type to “offline.”
source
share