I am attempting to use OktaAuth to get user info but the authClient.token is undefined so the call is not working. See setup below.
result of new OktaAuth - authClient is defined
authClient: {“options”:{“url”:“https://iimssnc.oktapreview.com”,“storageUtil”:{“storage”:{}}},“userAgent”:“okta-auth-js-server2.6.0”,“tx”:{}}
authClient.token is undefined so getUserInfo cannot be called.
authClient.token: undefined
const OktaAuth = require(’@okta/okta-auth-js’);
Setup:
const authClient = new OktaAuth({
url: ‘myurl’,
clientId: ‘myclientid’,
redirectUri: ‘myredirecturl’
});
const userinfo = await authClient.token.getUserInfo(token)
.then((user: any) => {
logger.info('res: ’ + JSON.stringify(user));
})
.catch((error: any) => {
logger.info('error getting okta user info: ’ + error);
});