You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/products/docs/pages/api-references/autopopulate-api-key.mdx
+42-2Lines changed: 42 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,17 @@ Fern can integrate with your authentication flow, allowing users to login and ha
13
13
14
14
With this feature, you can **create new users of your API** directly from within your documentation.
15
15
16
-
## How it works
16
+
## Choosing your auth flow
17
+
18
+
API key injection can work in two different ways depending on your company's authentication setup: **JWT or OAuth**.
19
+
20
+
***JWT Flow:** You handle the entire auth flow and just give Fern a JWT cookie
21
+
***OAuth Flow:** You give Fern access, and Fern directly handles the OAuth handshake process
22
+
23
+
<AccordionGroup>
24
+
<Accordiontitle="JWT"toc={true}>
25
+
26
+
### How it works
17
27
18
28
To enable this feature, you need to configure authentication so that Fern can securely retrieve API keys for your users. The process works as follows:
19
29
@@ -80,8 +90,38 @@ The JWT should have a structure similar to:
80
90
## Setting up auto-populated API keys
81
91
82
92
-[ ] Reach out to Fern to get your secret key
83
-
-[ ] Send Fern the URL of your authentication page (this is where users will be redirected to after clicking the "Login" button in the API Explorer)
93
+
-[ ] Send Fern the URL of your authentication page. This is where users will be redirected to after clicking the "Login" button in the API Explorer.
84
94
-[ ] Add logic to your service to set the `fern_token` cookie when a user logs in
85
95
86
96
<Tip>For an example of how to set up the `fern_token` cookie, see our demo implementation [here](https://github.com/fern-api/fern-platform/blob/app/packages/fern-docs/bundle/src/app/%5Bhost%5D/%5Bdomain%5D/api/fern-docs/auth/fern-token-demo/route.ts).</Tip>
87
97
98
+
</Accordion>
99
+
<Accordiontitle="OAuth"toc={true}>
100
+
101
+
### How it works
102
+
103
+
To enable this feature, you need to configure OAuth authentication so that Fern can securely retrieve API keys for your users through your OAuth provider. Here's how the process works:
104
+
105
+
1. When a user clicks the "Login" button in the API Explorer, Fern initiates an OAuth flow by making a request to your authorization endpoint.
106
+
1. The user is redirected to your OAuth provider's login page where they authenticate using your existing auth system.
107
+
1. After successful authentication, your OAuth provider redirects back to Fern with an authorization code, which Fern exchanges for an access token at your token endpoint.
108
+
1. Fern uses this token to retrieve the user's API key and automatically populates it in the API Explorer.
109
+
110
+
### Setting up auto-populated API keys
111
+
112
+
To enable API key injection, you'll need to:
113
+
-[ ] Set up an authenticated account for Fern so Fern can authorize users on your behalf. Provide Fern with
114
+
-[ ] Configure your OAuth application to return user API keys when Fern requests them
115
+
116
+
Then, you'll need to send Fern the following items:
117
+
- The client ID and client secret for Fern's authenticated account
118
+
- The URL of your authentication endpoint. This is where users will be redirected to after clicking the "Login" button in the API Explorer.
119
+
- The URL of your token endpoint. This is where Fern exchanges codes for tokens.
description: Understand the different authentication options Fern offers
4
+
---
5
+
6
+
Fern offers two methods of authentication, Single Sign-On (SSO) and Role-Based Access Control (RBAC).
7
+
8
+
**For most situations, we recommend using RBAC** for granular access control over your documentation. RBAC works well for sites with multiple audiences (internal teams, partners, customers) and supports API key injection to auto-populate code examples.
9
+
10
+
**SSO is simpler** but only provides basic login functionality - it doesn't support role-based permissions or API key injection. SSO works well for internal-only documentation where everyone should see the same content.
11
+
12
+
**API Key Injection** (available with RBAC only) can be set up using either JWT or OAuth, depending on your existing authentication system.
Copy file name to clipboardExpand all lines: fern/products/docs/pages/authentication/sso.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Single Sign-On
3
3
subtitle: Enterprise authentication for secure access to your Fern dashboard
4
4
---
5
5
6
-
Fern’s Single Sign-On (SSO) is an enterprise feature that lets your team securely access the Fern dashboard at `dashboard.buildwithfern.com` using your organization’s identity provider. This is designed for internal contributors, such as technical writers, product managers, or engineers, who need access to want to contribute to your documentation, view web analytics, or manage organizational settings.
6
+
Fern’s Single Sign-On (SSO) is an enterprise feature that lets your team securely access your Fern Docs site through your organization’s identity provider. This is designed for internal contributors, such as technical writers, product managers, or engineers, who need access to want to contribute to your documentation, view web analytics, or manage organizational settings.
0 commit comments