From b59a4f6b264afb98d62bfb6e83e46d41aa31be8d Mon Sep 17 00:00:00 2001 From: mayankshouche Date: Fri, 31 Jan 2025 15:42:30 -0800 Subject: [PATCH 1/3] add docs for redirect --- .../authentication-setup/jwt.mdx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/settings/authentication-personalization/authentication-setup/jwt.mdx b/settings/authentication-personalization/authentication-setup/jwt.mdx index d35fd7e3a..41961e87c 100644 --- a/settings/authentication-personalization/authentication-setup/jwt.mdx +++ b/settings/authentication-personalization/authentication-setup/jwt.mdx @@ -100,3 +100,20 @@ async def return_mintlify_auth_status(current_user): return RedirectResponse(url=f'https://docs.foo.com/login/jwt-callback#{jwt_token}', status_code=302) ``` + +## Redirecting Unauthenticated Users + +When an unauthenticated user tries to access a protected page, Mintlify preserves their intended destination through a redirect flow: + +1. The user attempts to visit a protected page (e.g., `/quickstart`) + +2. Mintlify redirects them to your login page and adds the original destination as a `redirect` query parameter + +Example: + +* Original request: [`https://docs.foo.com/quickstart`](https://docs.foo.com/quickstart) + +* Redirect to login: [`https://foo.com/docs-login?redirect=%2Fquickstart`](https://foo.com/docs-login?redirect=%2Fquickstart) + +After successful authentication, you can include this same `redirect` parameter in your JWT callback URL to send users to their intended destination: +`https://docs.foo.com/login/jwt-callback?redirect=%2Fquickstart#{SIGNED_JWT}` From 28a3d6e80414ca906566814d3bd38ab918f99a0e Mon Sep 17 00:00:00 2001 From: mayankshouche Date: Fri, 31 Jan 2025 15:43:56 -0800 Subject: [PATCH 2/3] change language --- .../authentication-setup/jwt.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/settings/authentication-personalization/authentication-setup/jwt.mdx b/settings/authentication-personalization/authentication-setup/jwt.mdx index 41961e87c..3bdd5b9a3 100644 --- a/settings/authentication-personalization/authentication-setup/jwt.mdx +++ b/settings/authentication-personalization/authentication-setup/jwt.mdx @@ -103,11 +103,11 @@ async def return_mintlify_auth_status(current_user): ## Redirecting Unauthenticated Users -When an unauthenticated user tries to access a protected page, Mintlify preserves their intended destination through a redirect flow: +When an unauthenticated user tries to access a specific page, Mintlify preserves their intended destination through a redirect flow: -1. The user attempts to visit a protected page (e.g., `/quickstart`) +1. The user attempts to visit a certain page (e.g., `/quickstart`) -2. Mintlify redirects them to your login page and adds the original destination as a `redirect` query parameter +2. Mintlify redirects them to your login URL and adds the original destination as a `redirect` query parameter Example: From fcb704c7c294ccf8a3d7b8b6059ac87d8df4434d Mon Sep 17 00:00:00 2001 From: mayankshouche Date: Mon, 3 Feb 2025 11:06:31 -0800 Subject: [PATCH 3/3] mention it's a relative path --- .../authentication-personalization/authentication-setup/jwt.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/authentication-personalization/authentication-setup/jwt.mdx b/settings/authentication-personalization/authentication-setup/jwt.mdx index 3bdd5b9a3..9bd212600 100644 --- a/settings/authentication-personalization/authentication-setup/jwt.mdx +++ b/settings/authentication-personalization/authentication-setup/jwt.mdx @@ -107,7 +107,7 @@ When an unauthenticated user tries to access a specific page, Mintlify preserves 1. The user attempts to visit a certain page (e.g., `/quickstart`) -2. Mintlify redirects them to your login URL and adds the original destination as a `redirect` query parameter +2. Mintlify redirects them to your login URL and adds the (relative) original destination as a `redirect` query parameter Example: