-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation edits made through Mintlify web editor
- Loading branch information
1 parent
d70b909
commit 0e05445
Showing
21 changed files
with
361 additions
and
1,410 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,46 +7,20 @@ import SubpathGatingSnippet from "/snippets/custom-subpath-gating.mdx"; | |
|
||
<SubpathGatingSnippet platform="Cloudflare" /> | ||
|
||
## Create Cloudflare Worker | ||
## Setup Instructions | ||
|
||
Navigate to the `Workers & Pages > Create application > Create worker`. You | ||
should be able to presented with the following screen where you can create a new | ||
Cloudlfare worker. | ||
1. Create a new Cloudflare Worker at `Workers & Pages > Create application > Create worker` | ||
|
||
<Frame> | ||
<img alt="Create a Cloudflare worker" src="/images/cloudflare/worker.png" /> | ||
</Frame> | ||
2. Add your custom domain: | ||
- Go to `Settings > Triggers` | ||
- Click `Add Custom Domain` | ||
- Add your domain (with and without `www.`) | ||
|
||
### Add custom domain | ||
|
||
Once the worker is created, click `Configure worker`. Navigate to the worker | ||
`Settings > Triggers`. Click on `Add Custom Domain` to add your desired domain | ||
into the list - we recommend you add both the version with and without `www.` | ||
prepended to the domain. | ||
|
||
<Frame> | ||
<img | ||
alt="Cloudflare worker custom domain" | ||
src="/images/cloudflare/custom-domain.png" | ||
/> | ||
</Frame> | ||
|
||
If you have trouble setting up a custom subdirectory, | ||
[contact our support team](mailto:[email protected]) and we'll walk you through | ||
upgrading your hosting with us. | ||
|
||
### Edit Worker Script | ||
|
||
Click on `Edit Code` and add the following script into the worker's code. | ||
|
||
<Frame> | ||
<img alt="Cloudflare edit code" src="/images/cloudflare/edit-code.png" /> | ||
</Frame> | ||
|
||
<Tip> | ||
Edit `DOCS_URL` by replacing `[SUBDOMAIN]` with your unique subdomain and | ||
`CUSTOM_URL` with your website's base URL. | ||
</Tip> | ||
3. Add the worker script: | ||
- Click `Edit Code` | ||
- Copy the script below | ||
- Replace `[SUBDOMAIN]` and `[YOUR_DOMAIN]` with your values | ||
- Click `Deploy` | ||
|
||
```javascript | ||
addEventListener("fetch", (event) => { | ||
|
@@ -80,5 +54,6 @@ async function handleRequest(request) { | |
} | ||
``` | ||
|
||
Click on `Deploy` and wait for the changes to propagate (it can take up to a few | ||
hours). | ||
<Note> | ||
Changes may take a few hours to propagate. For setup assistance, [contact our support team](mailto:[email protected]). | ||
</Note> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
--- | ||
title: 'OAuth 2.0' | ||
description: 'Integrate with your OAuth server to enable user login via the PKCE flow' | ||
description: 'Enable user login via OAuth PKCE flow' | ||
--- | ||
|
||
If you have an existing OAuth server that supports the PKCE flow, you can integrate with Mintlify for a seamless login experience. | ||
Integrate your existing OAuth server with Mintlify for user authentication using the PKCE flow. | ||
|
||
## Implementation | ||
## Setup Steps | ||
|
||
<Steps> | ||
<Step title="Create your Info API"> | ||
Create an API endpoint that can be accessed with an OAuth access token, and responds with a JSON payload following the [UserInfo](./sending-data) format. Take note of the scope or scopes required to access this endpoint. | ||
<Step title="Create Info API"> | ||
Create an API endpoint that: | ||
- Accepts an OAuth access token | ||
- Returns user data in [UserInfo](./sending-data) format | ||
- Has defined scope requirements | ||
</Step> | ||
<Step title="Configure your User Auth settings"> | ||
Go to your [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication), select the OAuth option, and fill out the required fields: | ||
|
||
- **Authorization URL**: The base URL for the authorization request, to which we will add the appropriate query parameters. | ||
- **Client ID**: An ID for the OAuth 2.0 client to be used. | ||
- **Scopes**: An array of scopes that will be requested. | ||
- **Token URL**: The base URL for the token exchange request. | ||
- **Info API URL**: The endpoint that will be hit to retrieve user info. | ||
<Step title="Set OAuth Configuration"> | ||
In your [Mintlify dashboard](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication): | ||
- Select OAuth option | ||
- Enter Authorization URL | ||
- Provide Client ID | ||
- List required Scopes | ||
- Add Token URL | ||
- Input Info API URL | ||
</Step> | ||
<Step title="Configure your OAuth client"> | ||
Copy the Redirect URL listed in the [Mintlify dashboard settings](https://dashboard.mintlify.com/mintlify/mintlify/settings/deployment/user-authentication) and add it as an authorized redirect URL for your OAuth server. | ||
<Step title="Add Redirect URL"> | ||
Copy the Redirect URL from your Mintlify dashboard and add it to your OAuth server's authorized redirects. | ||
</Step> | ||
</Steps> | ||
|
||
## Example | ||
|
||
I have an existing OAuth server that supports the PKCE flow. I want to set up authentication for my docs hosted at `foo.com/docs`. | ||
|
||
To set up authentication with Mintlify, I create an endpoint `api.foo.com/docs/user-info` which requires an OAuth access token with the `docs-user-info` scope, and responds with the user's custom data according to Mintlify’s specification. | ||
|
||
I then go to the Mintlify dashboard settings, navigate to the User Auth settings, select OAuth, and enter the relevant values for the OAuth flow and Info API endpoint: | ||
- **Authorization URL**: `https://auth.foo.com/authorization` | ||
- **Client ID**: `ydybo4SD8PR73vzWWd6S0ObH` | ||
- **Scopes**: `['docs-user-info']` | ||
- **Token URL**: `https://auth.foo.com/exchange` | ||
- **Info API URL**: `https://api.foo.com/docs/user-info` | ||
|
||
Finally, I copy the Redirect URL displayed in the dashboard settings and add it as an authorized redirect URL in my OAuth client configuration settings. | ||
## Quick Example | ||
|
||
```json | ||
{ | ||
"authorizationUrl": "https://auth.foo.com/authorization", | ||
"clientId": "ydybo4SD8PR73vzWWd6S0ObH", | ||
"scopes": ["docs-user-info"], | ||
"tokenUrl": "https://auth.foo.com/exchange", | ||
"infoApiUrl": "https://api.foo.com/docs/user-info" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.