KindeK
Kinde3y ago
6 replies
mnewcomer

NextJS App Router v2 getAccessToken() and getToken()

Hello again!

Loving Kinde (and can't wait for custom favicons....), but I've ran into a little bit of a desync between either my implementation or the kinde documentation.

I have a backend that I want to send the user's JWT to. I figured I would use the serverside method getAccessToken(), but it 1) returns null on a logged in user (profile pic, name, email from
getUser()
went fine, and 2) even if I got the KindeAccessToken there are no methods to convert it to a JWT (althought the documentation suggests getAccessToken() -> Promise<string>.

So, I was like, that's okay, I'll add the token on the client side api client with the kinde client methods from useKindeAuth,
getToken
seems to return string | null but I only get
null
still. Wondering why I can't seem to access the JWT even if it's stored in Application Cookies. Would love any help, very excited to finally get this integrated with the backend.

P.S. other than this token stuff I love the next app router sdk. it's been super easy to use and has sped up my development enormously.
Was this page helpful?