From 044ee0d7babab0292465110da8288b22ffc683a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Jakovljevi=C4=87?= Date: Tue, 3 Oct 2023 13:03:27 +0200 Subject: [PATCH] docs: add note about `onRequest` middleware exported from `serverAuth$` --- packages/docs/src/routes/docs/integrations/authjs/index.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/docs/src/routes/docs/integrations/authjs/index.mdx b/packages/docs/src/routes/docs/integrations/authjs/index.mdx index 994358d10f5..673283f5f20 100644 --- a/packages/docs/src/routes/docs/integrations/authjs/index.mdx +++ b/packages/docs/src/routes/docs/integrations/authjs/index.mdx @@ -218,6 +218,9 @@ export const { onRequest, useAuthSession, useAuthSignin, useAuthSignout } = serv }) ); ``` + +> *IMPORTANT*: Make sure to keep the `onRequest` export as it is used to handle the oAuth flow redirects. Once the user finished oAuth flow, GitHub (or any other provider) will redirect the user back to the application to `/api/auth/callback/github` (or `/api/auth/callback/[otherProvider]`). The `onRequest` middleware function will handle requests to this endpoint and finish the oAuth flow. + 3. Create or edit the `.env.local` file at the root of your project to store secrets ```bash title=".env.local"