Skip to content

Is there an easy to follow example of an Express BE + NextJS FE? #12306

Closed Answered by Randulfe
Randulfe asked this question in Help
Discussion options

You must be logged in to vote

Ok for whoever gets here, this is how you sort some of the issues with the integration:
Your FE client:

  • First make a request to get the CSRF token
  • Then make a POST request to your Express auth endpoint: domain/auth/signin/[provider]
    • Make sure that you are including credentials withCredentials: true in axios or credentials: 'include' in vanilla fetch
  • This request will respond with a corresponding URL that you want to redirect the user to so that they can sign in with the provider

Your express BE:

  • Make sure when defining the ExpressAuth you are setting the property callbacks: async redirect() { return [the URL of your home signed in page in your FE] }. This will redirect the applicati…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Randulfe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant