TypeError: Cannot read property 'idToken' of undefined


#1

I was following the quick start guide from https://developer.okta.com/quickstart/#/react/nodejs/generic. But when i try logging in this error occurs “TypeError: Cannot read property ‘idToken’ of undefined” Im not sure what I’m supposed to do.


#2

What do your App.js and Home.js files look like? There is probably a code error somewhere, but we’ll need to see the code to help.


#3

@nate.barbettini
this is App.js return

this is home.js return


#4

@nate.barbettini can you please help? I’m still stuck on this issue


#5

Some additional info when I sign in on route
http://localhost:3000/login

it redirects to

http://localhost:3000/implicit/callback#id_token=eyJraWQiOiJhWWFGaW1RTjJoZEp5NXRDYmZYRjRmYlhJS0NWVW00U3RQZVBrLVRqZ2o4IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIwMHVmcXhkNnZ3RFNFcjdobTBoNyIsIm5hbWUiOiJWaWV0IFRydW9uZyIsImVtYWlsIjoidmlldC50cnVvbmdAa29obHMuY29tIiwidmVyIjoxLCJpc3MiOiJodHRwczovL2Rldi0zMjg2MzIub2t0YXByZXZpZXcuY29tL29hdXRoMi9kZWZhdWx0IiwiYXVkIjoiMG9hZnF3ZW5tbXA5b3lyc2YwaDciLCJpYXQiOjE1MzIxMDYxMzAsImV4cCI6MTUzMjEwOTczMCwianRpIjoiSUQueWlHdzY0MEtnZWxXX2QxcXBKQnd6MWhDSWF1LUNOV3hKMXZRSHV4QkRQSSIsImFtciI6WyJwd2QiXSwiaWRwIjoiMDBvZnF4ZDZzZkU0WUljd3kwaDciLCJub25jZSI6ImZUekxBSGlSQ0xZUTBKZGdkeTUzYmpINWVmZFlNNGk3TmxLMm9YcVFibmZqTUY3V05oWUZuaFYzRGNZZG9YM3YiLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJ2aWV0LnRydW9uZ0Brb2hscy5jb20iLCJhdXRoX3RpbWUiOjE1MzIxMDU2MjMsImF0X2hhc2giOiJYa3hfeHZMeDRzOFJXZ1JiNGlYbE5nIn0.Ya37EHFXnh3a29AbcDQBiQaSddbJdRU9NrwbDqtwlSJ2JxA8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XfnwnKDzk6LRlqzvjnZ8XmD9yMmc9YmEl_V2-zcEpj80o0uXFaklcsAKf4YmGjmw&token_type=Bearer&expires_in=3600&scope=openid+profile+email&state=hsLSdLvjNKJqbG0dLtvJHTKoCrScHC6wIWR0X1InRG9Jl0H56PAjT8fWP8CxGrZY

then
http://localhost:3000/implicit/callback where it shows “TypeError: Cannot read property ‘idToken’ of undefined”


#6

Sorry for the delay. Did you make any progress? If not, are you using the latest version of the React SDK library?

Ping @jmelberg who can answer React questions better than I.


#7

Yea after digging around I found the error


#8

I’m curious, what was it?


#9

I was using withRouter and that affected the page reloading