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

fix generateSessionToken #6200

Merged
merged 4 commits into from
Jan 9, 2023

Conversation

OrJDev
Copy link
Contributor

@OrJDev OrJDev commented Dec 27, 2022

NOTE:

  • It's a good idea to open an issue first to discuss potential changes.
  • Please make sure that you are NOT opening a PR to fix a potential security vulnerability. Instead, please follow the Security guidelines to disclose the issue to us confidentially.

☕️ Reasoning

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Please scout and link issues that might be solved by this PR.

Fixes: INSERT_ISSUE_LINK_HERE

📌 Resources

closes #6076

Looks like when passing the generateSessionToken an arrow function that calls the randomUUID function instead of passing the randomUUID function directly, solves this problem.

So instead of

myFunc: crypto.randomUUID

It should be

myFunc: () => crypto.randomUUID()

@vercel
Copy link

vercel bot commented Dec 27, 2022

@OrJDev is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Dec 27, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
auth-docs ❌ Failed (Inspect) Dec 28, 2022 at 1:44PM (UTC)

@OrJDev OrJDev changed the title fix fix generateSessionToken Dec 27, 2022
@ndom91
Copy link
Member

ndom91 commented Dec 28, 2022

Strange, so I figure the initial way shuold have worked. Btw there was a small typo in your PR description above. It shuold be the following:

myFunc: crypto.randomUUID <-- function, not function call

it should be

myfunc: ()=> crypto.randomUUID()

In the rest of the adapter code, its always just called as myFunc() (for example).

@ndom91
Copy link
Member

ndom91 commented Dec 28, 2022

Testing it all in the a REPL though, this update looks correct. Calling it like myFunc() will then work correctly 👍

@OrJDev
Copy link
Contributor Author

OrJDev commented Dec 28, 2022

Ye i do have a typo I don't really know how to explain the changes because it makes absolutely no sense.
I expected the normal way to work as there is nothing that is messing with the binding in here.
Anyways im glad it works.

@github-actions github-actions bot added the core Refers to `@auth/core` label Jan 9, 2023
@balazsorban44 balazsorban44 merged commit d8481f3 into nextauthjs:main Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@auth/sveltekit: PrismaAdapter causing callback errors
3 participants