getIdToken error
Hi! I'm liking Kinde so far but I'm facing an issue implementing it in our NextJS application. Calling
getIdToken
on the user session always returns null. If I enable debug then I get the following error trace logged:
Is this a bug? Am I doing something wrong? Thanks in advance!15 Replies
Hey, which version of the sdk are you using ?
Could you please share a snippet of the code you're using ?
Sure - I had the same problem with the latest version 2.4.3 and the version in the NextJS starter kit which is 2.3.10
I am simply doing
In this example,
rawIdToken
has a value but idToken
is null
This is odd. Maybe something going off with cache. Have you tried login out and back in ? In my end getIdtoken works
Yep - also tried on private browser
I get this using the nextjs app router starter kit out of the box and just adding the getIdToken call into the dashboard page as follows:
Output is the following:
When you open the application tab of the dev console does the token exists in there ?
Yes there is an encoded id_token cookie
Which is the same as what is returned by
getRawIdToken
But decoding the token does not seem to workHi @agr , Could you please try
@kinde-oss/[email protected]
, This is a pre-release of the next version which may resolve your problem.
Let me know how you get on@Daniel_Kinde still no luck I'm afraid
Tried upgrading to 2.4.5-0 and also adding wrapping the app in the
KindeProvider
which I realised was missing before (though shouldn't make any difference as this is a server-rendered page) but getIdToken
is still returning null
😦Could you please navigate to
/api/auth/health
and let me know the output?Sure
@Daniel_Kinde any thoughts on this?
Thanks for raising this, I'll see if I can recreate it - this seems like a bug
@agr A fix has been released, please update to
2.4.5
Thanks, that works now!
Great thanks for letting me know