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

How to identify user between /login and /callback #83

Open
feresr opened this issue Nov 23, 2023 · 2 comments
Open

How to identify user between /login and /callback #83

feresr opened this issue Nov 23, 2023 · 2 comments

Comments

@feresr
Copy link

feresr commented Nov 23, 2023

From the example, it is not clear how an user can be matched between the '/login' and '/callback' method calls

Expected behavior

A realistic example where the 'client' object is not static at the server scope.
https://github.com/twitterdev/twitter-api-typescript-sdk/blob/0d12a20a76d6dd9c346decf9cc80bc611975d43f/examples/oauth2-callback_pkce_s256.ts#L39C2-L39C25

Actual behavior

The example uses a global 'client' and only deals with authenticating one user. A real server state is shared between multiple clients. It is not clear how we can identify a user in the ''/callback' endpoint.

@feresr
Copy link
Author

feresr commented Nov 24, 2023

I tried a few things to get OAuth2User from /login across to /callback (stateless functions)

Just creating a new User with the same settings won't work because code_verifier gets assigned on generateAuthURL() (which is called in /login)

What is more, OAuth2User is not serializable, do I need a way to share memory between API endpoints in NextJS? Is that possible?

@programador51
Copy link

Could you realize how to ? I have tried all the steps (but on nextjs) and I get Value passed for the authorization code was invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants