Cannot read property "access_token" of undefined
syonip opened this issue · 3 comments
After running the migration to okta tool, and making the config changes described, getting this error when performing user authentication.
C:\git\dumpstr\node_modules\express-stormpath\lib\helpers\authenticate.js:41
accessTokenAuthenticator.authenticate(oauthAccessTokenResult.access_token, function (err, authenticationR
esult) {
^
TypeError: Cannot read property 'access_token' of undefined
at C:\git\dumpstr\node_modules\express-stormpath\lib\helpers\authenticate.js:41:67
at Request._callback (C:\git\dumpstr\node_modules\express-stormpath\lib\okta\request-executor.js:20:5)
at Request.self.callback (C:\git\dumpstr\node_modules\request\request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request.<anonymous> (C:\git\dumpstr\node_modules\request\request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage.<anonymous> (C:\git\dumpstr\node_modules\request\request.js:1091:12)
at IncomingMessage.g (events.js:292:16) `
Hey @syonip- If you have '-admin' on the end of your base URL environment variable, eg: https://dev-ID-admin.oktapreview.com, you will successfully be able to register users but will get this undefined token error when trying to authenticate. The URL you need to use is https://dev-ID.oktapreview.com without the '-admin' part. Please make that change and test this out again.
@robertdamphousse-okta is also working on adding this check to the library with a clear error message, so the server startup will fail if the base URL is incorrect.
Yes that did the trick, thanks!
In RC4 I've added a catc for this, thanks all for debugging!