Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Null ID token in server context in 2.4.6 #252

Closed
4 tasks done
Yoshify opened this issue Dec 11, 2024 · 0 comments
Closed
4 tasks done

Bug: Null ID token in server context in 2.4.6 #252

Yoshify opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Yoshify
Copy link
Collaborator

Yoshify commented Dec 11, 2024

Prerequisites

Describe the issue

I've found a bug when attempting to access ID tokens in middleware or an SSR context on Next 15 - the initial pass always returns null.

I've narrowed it down to this line here

getIdToken is returning a promise and we're passing that directly to the jwtDecoder, I believe it needs to be awaited first.
I've implemented that change in a local copy of the repo and it works great now.

To replicate it, enable debug logging and try to access getIdToken from getKindeServerSession in a middleware or server component- it throws [TypeError: fe(...).getSessionItem is not a function] because we're not awaiting the creation of the session manager object and it then returns a null id token.

This was resolved in version 2.4.5, and downgrading fixes the error, but the issue was reintroduced in 2.4.6.

Library URL

https://github.com/kinde-oss/kinde-auth-nextjs

Library version

2.4.6

Operating system(s)

Windows

Operating system version(s)

11

Further environment details

No response

Reproducible test case URL

No response

Additional information

No response

@Yoshify Yoshify added the bug Something isn't working label Dec 11, 2024
@Yoshify Yoshify changed the title Bug: Null ID token in SSR/Middleware in 2.4.6 Bug: Null ID token in server context in 2.4.6 Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant