@farmsdotmarket/openauth 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @farmsdotmarket/openauth might be problematic. Click here for more details.
- package/.changeset/README.md +8 -0
- package/.changeset/commit.cjs +4 -0
- package/.changeset/config.json +11 -0
- package/.changeset/farms-openauth-release-0-4-3-farms-2.md +10 -0
- package/.changeset/popular-geese-reply.md +5 -0
- package/.changeset/stupid-boats-play.md +5 -0
- package/.changeset/ten-pans-invent.md +5 -0
- package/.github/CODE_OF_CONDUCT +15 -0
- package/.github/workflows/docs.yml +39 -0
- package/.github/workflows/format.yml +26 -0
- package/.github/workflows/release.yml +28 -0
- package/.github/workflows/test.yml +20 -0
- package/.prettierrc +3 -0
- package/CNAME +1 -0
- package/FARMS_RELEASE.md +82 -0
- package/LICENSE +22 -0
- package/PATCHES.md +32 -0
- package/README.md +311 -0
- package/bun.lockb +0 -0
- package/bunfig.toml +2 -0
- package/examples/README.md +28 -0
- package/examples/client/astro/.vscode/extensions.json +4 -0
- package/examples/client/astro/.vscode/launch.json +11 -0
- package/examples/client/astro/README.md +7 -0
- package/examples/client/astro/astro.config.mjs +10 -0
- package/examples/client/astro/package.json +15 -0
- package/examples/client/astro/public/favicon.svg +9 -0
- package/examples/client/astro/src/assets/astro.svg +1 -0
- package/examples/client/astro/src/assets/background.svg +1 -0
- package/examples/client/astro/src/auth.ts +23 -0
- package/examples/client/astro/src/components/Welcome.astro +209 -0
- package/examples/client/astro/src/env.d.ts +10 -0
- package/examples/client/astro/src/layouts/Layout.astro +22 -0
- package/examples/client/astro/src/middleware.ts +31 -0
- package/examples/client/astro/src/pages/callback.ts +19 -0
- package/examples/client/astro/src/pages/index.astro +11 -0
- package/examples/client/astro/tsconfig.json +5 -0
- package/examples/client/cloudflare-api/api.ts +80 -0
- package/examples/client/cloudflare-api/package.json +5 -0
- package/examples/client/jwt-api/CHANGELOG.md +8 -0
- package/examples/client/jwt-api/README.md +13 -0
- package/examples/client/jwt-api/index.ts +45 -0
- package/examples/client/jwt-api/package.json +15 -0
- package/examples/client/lambda-api/api.ts +69 -0
- package/examples/client/lambda-api/package.json +5 -0
- package/examples/client/nextjs/CHANGELOG.md +46 -0
- package/examples/client/nextjs/README.md +26 -0
- package/examples/client/nextjs/app/actions.ts +61 -0
- package/examples/client/nextjs/app/api/callback/route.ts +11 -0
- package/examples/client/nextjs/app/auth.ts +29 -0
- package/examples/client/nextjs/app/favicon.ico +0 -0
- package/examples/client/nextjs/app/globals.css +42 -0
- package/examples/client/nextjs/app/layout.tsx +32 -0
- package/examples/client/nextjs/app/page.module.css +169 -0
- package/examples/client/nextjs/app/page.tsx +97 -0
- package/examples/client/nextjs/next.config.ts +7 -0
- package/examples/client/nextjs/package.json +23 -0
- package/examples/client/nextjs/public/file.svg +1 -0
- package/examples/client/nextjs/public/globe.svg +1 -0
- package/examples/client/nextjs/public/next.svg +1 -0
- package/examples/client/nextjs/public/vercel.svg +1 -0
- package/examples/client/nextjs/public/window.svg +1 -0
- package/examples/client/nextjs/tsconfig.json +27 -0
- package/examples/client/react/README.md +29 -0
- package/examples/client/react/index.html +13 -0
- package/examples/client/react/package.json +30 -0
- package/examples/client/react/public/vite.svg +1 -0
- package/examples/client/react/src/App.tsx +39 -0
- package/examples/client/react/src/AuthContext.tsx +153 -0
- package/examples/client/react/src/assets/react.svg +1 -0
- package/examples/client/react/src/main.tsx +12 -0
- package/examples/client/react/src/vite-env.d.ts +1 -0
- package/examples/client/react/tsconfig.app.json +26 -0
- package/examples/client/react/tsconfig.json +11 -0
- package/examples/client/react/tsconfig.node.json +24 -0
- package/examples/client/react/vite.config.ts +7 -0
- package/examples/client/sveltekit/package.json +24 -0
- package/examples/client/sveltekit/src/app.d.ts +15 -0
- package/examples/client/sveltekit/src/app.html +12 -0
- package/examples/client/sveltekit/src/hooks.server.ts +29 -0
- package/examples/client/sveltekit/src/lib/auth.server.ts +29 -0
- package/examples/client/sveltekit/src/routes/+page.server.ts +5 -0
- package/examples/client/sveltekit/src/routes/+page.svelte +5 -0
- package/examples/client/sveltekit/src/routes/callback/+server.ts +17 -0
- package/examples/client/sveltekit/static/favicon.png +0 -0
- package/examples/client/sveltekit/svelte.config.js +18 -0
- package/examples/client/sveltekit/tsconfig.json +19 -0
- package/examples/client/sveltekit/vite.config.ts +6 -0
- package/examples/issuer/bun/issuer.ts +43 -0
- package/examples/issuer/bun/package.json +7 -0
- package/examples/issuer/cloudflare/issuer.ts +47 -0
- package/examples/issuer/cloudflare/package.json +8 -0
- package/examples/issuer/cloudflare/sst-env.d.ts +17 -0
- package/examples/issuer/cloudflare/sst.config.ts +23 -0
- package/examples/issuer/custom-frontend/auth/issuer.ts +43 -0
- package/examples/issuer/custom-frontend/auth/package.json +7 -0
- package/examples/issuer/custom-frontend/frontend/frontend.tsx +57 -0
- package/examples/issuer/custom-frontend/frontend/package.json +6 -0
- package/examples/issuer/custom-frontend/package.json +5 -0
- package/examples/issuer/lambda/issuer.ts +35 -0
- package/examples/issuer/lambda/package.json +8 -0
- package/examples/issuer/lambda/sst-env.d.ts +9 -0
- package/examples/issuer/lambda/sst.config.ts +15 -0
- package/examples/issuer/node/authorizer.ts +38 -0
- package/examples/issuer/node/package.json +5 -0
- package/examples/quickstart/sst/README.md +36 -0
- package/examples/quickstart/sst/app/actions.ts +62 -0
- package/examples/quickstart/sst/app/api/callback/route.ts +15 -0
- package/examples/quickstart/sst/app/auth.ts +29 -0
- package/examples/quickstart/sst/app/favicon.ico +0 -0
- package/examples/quickstart/sst/app/globals.css +42 -0
- package/examples/quickstart/sst/app/layout.tsx +32 -0
- package/examples/quickstart/sst/app/page.module.css +200 -0
- package/examples/quickstart/sst/app/page.tsx +53 -0
- package/examples/quickstart/sst/auth/index.ts +37 -0
- package/examples/quickstart/sst/auth/subjects.ts +8 -0
- package/examples/quickstart/sst/next.config.ts +7 -0
- package/examples/quickstart/sst/package-lock.json +1165 -0
- package/examples/quickstart/sst/package.json +26 -0
- package/examples/quickstart/sst/public/file.svg +1 -0
- package/examples/quickstart/sst/public/globe.svg +1 -0
- package/examples/quickstart/sst/public/next.svg +1 -0
- package/examples/quickstart/sst/public/vercel.svg +1 -0
- package/examples/quickstart/sst/public/window.svg +1 -0
- package/examples/quickstart/sst/sst-env.d.ts +18 -0
- package/examples/quickstart/sst/sst.config.ts +21 -0
- package/examples/quickstart/sst/tsconfig.json +27 -0
- package/examples/quickstart/standalone/README.md +36 -0
- package/examples/quickstart/standalone/app/actions.ts +62 -0
- package/examples/quickstart/standalone/app/api/callback/route.ts +15 -0
- package/examples/quickstart/standalone/app/auth.ts +28 -0
- package/examples/quickstart/standalone/app/favicon.ico +0 -0
- package/examples/quickstart/standalone/app/globals.css +42 -0
- package/examples/quickstart/standalone/app/layout.tsx +32 -0
- package/examples/quickstart/standalone/app/page.module.css +200 -0
- package/examples/quickstart/standalone/app/page.tsx +53 -0
- package/examples/quickstart/standalone/auth/index.ts +32 -0
- package/examples/quickstart/standalone/auth/subjects.ts +8 -0
- package/examples/quickstart/standalone/bun.lockb +0 -0
- package/examples/quickstart/standalone/next.config.ts +7 -0
- package/examples/quickstart/standalone/package.json +25 -0
- package/examples/quickstart/standalone/public/file.svg +1 -0
- package/examples/quickstart/standalone/public/globe.svg +1 -0
- package/examples/quickstart/standalone/public/next.svg +1 -0
- package/examples/quickstart/standalone/public/vercel.svg +1 -0
- package/examples/quickstart/standalone/public/window.svg +1 -0
- package/examples/quickstart/standalone/tsconfig.json +27 -0
- package/examples/subjects.ts +8 -0
- package/examples/tsconfig.json +10 -0
- package/package.json +23 -0
- package/packages/openauth/CHANGELOG.md +310 -0
- package/packages/openauth/bunfig.toml +2 -0
- package/packages/openauth/package.json +51 -0
- package/packages/openauth/script/build.ts +25 -0
- package/packages/openauth/src/client-native.ts +204 -0
- package/packages/openauth/src/client.ts +776 -0
- package/packages/openauth/src/css.d.ts +4 -0
- package/packages/openauth/src/error.ts +120 -0
- package/packages/openauth/src/index.ts +26 -0
- package/packages/openauth/src/issuer.ts +1156 -0
- package/packages/openauth/src/jwt.ts +17 -0
- package/packages/openauth/src/keys.ts +139 -0
- package/packages/openauth/src/pkce.ts +40 -0
- package/packages/openauth/src/provider/apple.ts +127 -0
- package/packages/openauth/src/provider/arctic.ts +66 -0
- package/packages/openauth/src/provider/code.ts +227 -0
- package/packages/openauth/src/provider/cognito.ts +74 -0
- package/packages/openauth/src/provider/discord.ts +45 -0
- package/packages/openauth/src/provider/facebook.ts +84 -0
- package/packages/openauth/src/provider/github.ts +45 -0
- package/packages/openauth/src/provider/google.ts +85 -0
- package/packages/openauth/src/provider/index.ts +3 -0
- package/packages/openauth/src/provider/jumpcloud.ts +45 -0
- package/packages/openauth/src/provider/keycloak.ts +75 -0
- package/packages/openauth/src/provider/linkedin.ts +12 -0
- package/packages/openauth/src/provider/microsoft.ts +100 -0
- package/packages/openauth/src/provider/oauth2.ts +297 -0
- package/packages/openauth/src/provider/oidc.ts +179 -0
- package/packages/openauth/src/provider/password.ts +672 -0
- package/packages/openauth/src/provider/provider.ts +33 -0
- package/packages/openauth/src/provider/slack.ts +67 -0
- package/packages/openauth/src/provider/spotify.ts +45 -0
- package/packages/openauth/src/provider/twitch.ts +45 -0
- package/packages/openauth/src/provider/x.ts +46 -0
- package/packages/openauth/src/provider/yahoo.ts +45 -0
- package/packages/openauth/src/random.ts +28 -0
- package/packages/openauth/src/storage/aws.ts +59 -0
- package/packages/openauth/src/storage/cloudflare.ts +77 -0
- package/packages/openauth/src/storage/dynamo.ts +193 -0
- package/packages/openauth/src/storage/memory.ts +135 -0
- package/packages/openauth/src/storage/storage.ts +46 -0
- package/packages/openauth/src/subject.ts +130 -0
- package/packages/openauth/src/ui/base.tsx +118 -0
- package/packages/openauth/src/ui/code.tsx +212 -0
- package/packages/openauth/src/ui/form.tsx +40 -0
- package/packages/openauth/src/ui/icon.tsx +95 -0
- package/packages/openauth/src/ui/password.tsx +403 -0
- package/packages/openauth/src/ui/select.tsx +221 -0
- package/packages/openauth/src/ui/theme.ts +319 -0
- package/packages/openauth/src/ui/ui.css +252 -0
- package/packages/openauth/src/util.ts +58 -0
- package/packages/openauth/test/client-native.test.ts +30 -0
- package/packages/openauth/test/client.test.ts +177 -0
- package/packages/openauth/test/issuer.test.ts +393 -0
- package/packages/openauth/test/scrap.test.ts +85 -0
- package/packages/openauth/test/storage.test.ts +94 -0
- package/packages/openauth/test/util.test.ts +103 -0
- package/packages/openauth/tsconfig.json +13 -0
- package/scripts/format +15 -0
- package/www/.vscode/extensions.json +4 -0
- package/www/.vscode/launch.json +11 -0
- package/www/README.md +55 -0
- package/www/astro.config.mjs +136 -0
- package/www/bun.lockb +0 -0
- package/www/config.ts +4 -0
- package/www/generate.ts +911 -0
- package/www/package.json +24 -0
- package/www/public/favicon-dark.svg +3 -0
- package/www/public/favicon.ico +0 -0
- package/www/public/favicon.svg +3 -0
- package/www/public/social-share.png +0 -0
- package/www/src/assets/logo-dark.svg +11 -0
- package/www/src/assets/logo-light.svg +11 -0
- package/www/src/components/Hero.astro +11 -0
- package/www/src/components/Lander.astro +176 -0
- package/www/src/content/config.ts +6 -0
- package/www/src/content/docs/docs/client.mdx +650 -0
- package/www/src/content/docs/docs/index.mdx +325 -0
- package/www/src/content/docs/docs/issuer.mdx +512 -0
- package/www/src/content/docs/docs/provider/apple.mdx +233 -0
- package/www/src/content/docs/docs/provider/code.mdx +163 -0
- package/www/src/content/docs/docs/provider/cognito.mdx +173 -0
- package/www/src/content/docs/docs/provider/discord.mdx +139 -0
- package/www/src/content/docs/docs/provider/facebook.mdx +233 -0
- package/www/src/content/docs/docs/provider/github.mdx +139 -0
- package/www/src/content/docs/docs/provider/google.mdx +233 -0
- package/www/src/content/docs/docs/provider/jumpcloud.mdx +139 -0
- package/www/src/content/docs/docs/provider/keycloak.mdx +176 -0
- package/www/src/content/docs/docs/provider/microsoft.mdx +252 -0
- package/www/src/content/docs/docs/provider/oauth2.mdx +173 -0
- package/www/src/content/docs/docs/provider/oidc.mdx +113 -0
- package/www/src/content/docs/docs/provider/password.mdx +237 -0
- package/www/src/content/docs/docs/provider/slack.mdx +157 -0
- package/www/src/content/docs/docs/provider/spotify.mdx +139 -0
- package/www/src/content/docs/docs/provider/twitch.mdx +139 -0
- package/www/src/content/docs/docs/provider/x.mdx +139 -0
- package/www/src/content/docs/docs/provider/yahoo.mdx +139 -0
- package/www/src/content/docs/docs/start/nextjs-dark.png +0 -0
- package/www/src/content/docs/docs/start/nextjs-light.png +0 -0
- package/www/src/content/docs/docs/start/sst.mdx +423 -0
- package/www/src/content/docs/docs/start/standalone.mdx +376 -0
- package/www/src/content/docs/docs/storage/cloudflare.mdx +63 -0
- package/www/src/content/docs/docs/storage/dynamo.mdx +127 -0
- package/www/src/content/docs/docs/storage/memory.mdx +77 -0
- package/www/src/content/docs/docs/subject.mdx +139 -0
- package/www/src/content/docs/docs/themes-dark.png +0 -0
- package/www/src/content/docs/docs/themes-light.png +0 -0
- package/www/src/content/docs/docs/ui/code.mdx +248 -0
- package/www/src/content/docs/docs/ui/password.mdx +410 -0
- package/www/src/content/docs/docs/ui/select.mdx +99 -0
- package/www/src/content/docs/docs/ui/theme.mdx +284 -0
- package/www/src/content/docs/index.mdx +12 -0
- package/www/src/custom.css +0 -0
- package/www/src/env.d.ts +2 -0
- package/www/src/styles/lander.css +15 -0
- package/www/tsconfig.json +3 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: GoogleProvider
|
|
3
|
+
editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/google.ts
|
|
4
|
+
description: Reference doc for the `GoogleProvider`.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { Segment, Section, NestedTitle, InlineSection } from 'toolbeam-docs-theme/components'
|
|
8
|
+
import { Tabs, TabItem } from '@astrojs/starlight/components'
|
|
9
|
+
|
|
10
|
+
<div class="tsdoc">
|
|
11
|
+
<Section type="about">
|
|
12
|
+
Use this provider to authenticate with Google. Supports both OAuth2 and OIDC.
|
|
13
|
+
|
|
14
|
+
#### Using OAuth
|
|
15
|
+
|
|
16
|
+
```ts {5-8}
|
|
17
|
+
import { GoogleProvider } from "@openauthjs/openauth/provider/google"
|
|
18
|
+
|
|
19
|
+
export default issuer({
|
|
20
|
+
providers: {
|
|
21
|
+
google: GoogleProvider({
|
|
22
|
+
clientID: "1234567890",
|
|
23
|
+
clientSecret: "0987654321"
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Using OIDC
|
|
30
|
+
|
|
31
|
+
```ts {5-7}
|
|
32
|
+
import { GoogleOidcProvider } from "@openauthjs/openauth/provider/google"
|
|
33
|
+
|
|
34
|
+
export default issuer({
|
|
35
|
+
providers: {
|
|
36
|
+
google: GoogleOidcProvider({
|
|
37
|
+
clientID: "1234567890"
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
</Section>
|
|
43
|
+
---
|
|
44
|
+
## Methods
|
|
45
|
+
### GoogleOidcProvider
|
|
46
|
+
<Segment>
|
|
47
|
+
<Section type="signature">
|
|
48
|
+
```ts
|
|
49
|
+
GoogleOidcProvider(config)
|
|
50
|
+
```
|
|
51
|
+
</Section>
|
|
52
|
+
<Section type="parameters">
|
|
53
|
+
#### Parameters
|
|
54
|
+
- <p><code class="key">config</code> [<code class="type">GoogleOidcConfig</code>](/docs/provider/google#googleoidcconfig)</p>
|
|
55
|
+
The config for the provider.
|
|
56
|
+
</Section>
|
|
57
|
+
<InlineSection>
|
|
58
|
+
**Returns** <code class="type">Provider</code>
|
|
59
|
+
</InlineSection>
|
|
60
|
+
Create a Google OIDC provider.
|
|
61
|
+
|
|
62
|
+
This is useful if you just want to verify the user's email address.
|
|
63
|
+
```ts
|
|
64
|
+
GoogleOidcProvider({
|
|
65
|
+
clientID: "1234567890"
|
|
66
|
+
})
|
|
67
|
+
```
|
|
68
|
+
</Segment>
|
|
69
|
+
### GoogleProvider
|
|
70
|
+
<Segment>
|
|
71
|
+
<Section type="signature">
|
|
72
|
+
```ts
|
|
73
|
+
GoogleProvider(config)
|
|
74
|
+
```
|
|
75
|
+
</Section>
|
|
76
|
+
<Section type="parameters">
|
|
77
|
+
#### Parameters
|
|
78
|
+
- <p><code class="key">config</code> [<code class="type">GoogleConfig</code>](/docs/provider/google#googleconfig)</p>
|
|
79
|
+
The config for the provider.
|
|
80
|
+
</Section>
|
|
81
|
+
<InlineSection>
|
|
82
|
+
**Returns** <code class="type">Provider</code>
|
|
83
|
+
</InlineSection>
|
|
84
|
+
Create a Google OAuth2 provider.
|
|
85
|
+
```ts
|
|
86
|
+
GoogleProvider({
|
|
87
|
+
clientID: "1234567890",
|
|
88
|
+
clientSecret: "0987654321"
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
</Segment>
|
|
92
|
+
## GoogleConfig
|
|
93
|
+
<Segment>
|
|
94
|
+
<Section type="parameters">
|
|
95
|
+
- <p>[<code class="key">clientID</code>](#googleconfig.clientid) <code class="primitive">string</code></p>
|
|
96
|
+
- <p>[<code class="key">clientSecret</code>](#googleconfig.clientsecret) <code class="primitive">string</code></p>
|
|
97
|
+
- <p>[<code class="key">pkce?</code>](#googleconfig.pkce) <code class="primitive">boolean</code></p>
|
|
98
|
+
- <p>[<code class="key">query?</code>](#googleconfig.query) <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code></p>
|
|
99
|
+
- <p>[<code class="key">scopes</code>](#googleconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
|
|
100
|
+
</Section>
|
|
101
|
+
</Segment>
|
|
102
|
+
<NestedTitle id="googleconfig.clientid" Tag="h4" parent="GoogleConfig.">clientID</NestedTitle>
|
|
103
|
+
<Segment>
|
|
104
|
+
<Section type="parameters">
|
|
105
|
+
<InlineSection>
|
|
106
|
+
**Type** <code class="primitive">string</code>
|
|
107
|
+
</InlineSection>
|
|
108
|
+
</Section>
|
|
109
|
+
The client ID.
|
|
110
|
+
|
|
111
|
+
This is just a string to identify your app.
|
|
112
|
+
```ts
|
|
113
|
+
{
|
|
114
|
+
clientID: "my-client"
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
</Segment>
|
|
118
|
+
<NestedTitle id="googleconfig.clientsecret" Tag="h4" parent="GoogleConfig.">clientSecret</NestedTitle>
|
|
119
|
+
<Segment>
|
|
120
|
+
<Section type="parameters">
|
|
121
|
+
<InlineSection>
|
|
122
|
+
**Type** <code class="primitive">string</code>
|
|
123
|
+
</InlineSection>
|
|
124
|
+
</Section>
|
|
125
|
+
The client secret.
|
|
126
|
+
|
|
127
|
+
This is a private key that's used to authenticate your app. It should be kept secret.
|
|
128
|
+
```ts
|
|
129
|
+
{
|
|
130
|
+
clientSecret: "0987654321"
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
</Segment>
|
|
134
|
+
<NestedTitle id="googleconfig.pkce" Tag="h4" parent="GoogleConfig.">pkce?</NestedTitle>
|
|
135
|
+
<Segment>
|
|
136
|
+
<Section type="parameters">
|
|
137
|
+
<InlineSection>
|
|
138
|
+
**Type** <code class="primitive">boolean</code>
|
|
139
|
+
</InlineSection>
|
|
140
|
+
</Section>
|
|
141
|
+
|
|
142
|
+
<InlineSection>
|
|
143
|
+
**Default** false
|
|
144
|
+
</InlineSection>
|
|
145
|
+
Whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow.
|
|
146
|
+
Some providers like x.com require this.
|
|
147
|
+
</Segment>
|
|
148
|
+
<NestedTitle id="googleconfig.query" Tag="h4" parent="GoogleConfig.">query?</NestedTitle>
|
|
149
|
+
<Segment>
|
|
150
|
+
<Section type="parameters">
|
|
151
|
+
<InlineSection>
|
|
152
|
+
**Type** <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code>
|
|
153
|
+
</InlineSection>
|
|
154
|
+
</Section>
|
|
155
|
+
Any additional parameters that you want to pass to the authorization endpoint.
|
|
156
|
+
```ts
|
|
157
|
+
{
|
|
158
|
+
query: {
|
|
159
|
+
access_type: "offline",
|
|
160
|
+
prompt: "consent"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
</Segment>
|
|
165
|
+
<NestedTitle id="googleconfig.scopes" Tag="h4" parent="GoogleConfig.">scopes</NestedTitle>
|
|
166
|
+
<Segment>
|
|
167
|
+
<Section type="parameters">
|
|
168
|
+
<InlineSection>
|
|
169
|
+
**Type** <code class="primitive">string</code><code class="symbol">[]</code>
|
|
170
|
+
</InlineSection>
|
|
171
|
+
</Section>
|
|
172
|
+
A list of OAuth scopes that you want to request.
|
|
173
|
+
```ts
|
|
174
|
+
{
|
|
175
|
+
scopes: ["email", "profile"]
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
</Segment>
|
|
179
|
+
## GoogleOidcConfig
|
|
180
|
+
<Segment>
|
|
181
|
+
<Section type="parameters">
|
|
182
|
+
- <p>[<code class="key">clientID</code>](#googleoidcconfig.clientid) <code class="primitive">string</code></p>
|
|
183
|
+
- <p>[<code class="key">query?</code>](#googleoidcconfig.query) <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code></p>
|
|
184
|
+
- <p>[<code class="key">scopes?</code>](#googleoidcconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
|
|
185
|
+
</Section>
|
|
186
|
+
</Segment>
|
|
187
|
+
<NestedTitle id="googleoidcconfig.clientid" Tag="h4" parent="GoogleOidcConfig.">clientID</NestedTitle>
|
|
188
|
+
<Segment>
|
|
189
|
+
<Section type="parameters">
|
|
190
|
+
<InlineSection>
|
|
191
|
+
**Type** <code class="primitive">string</code>
|
|
192
|
+
</InlineSection>
|
|
193
|
+
</Section>
|
|
194
|
+
The client ID.
|
|
195
|
+
|
|
196
|
+
This is just a string to identify your app.
|
|
197
|
+
```ts
|
|
198
|
+
{
|
|
199
|
+
clientID: "my-client"
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
</Segment>
|
|
203
|
+
<NestedTitle id="googleoidcconfig.query" Tag="h4" parent="GoogleOidcConfig.">query?</NestedTitle>
|
|
204
|
+
<Segment>
|
|
205
|
+
<Section type="parameters">
|
|
206
|
+
<InlineSection>
|
|
207
|
+
**Type** <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code>
|
|
208
|
+
</InlineSection>
|
|
209
|
+
</Section>
|
|
210
|
+
Any additional parameters that you want to pass to the authorization endpoint.
|
|
211
|
+
```ts
|
|
212
|
+
{
|
|
213
|
+
query: {
|
|
214
|
+
prompt: "consent"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
</Segment>
|
|
219
|
+
<NestedTitle id="googleoidcconfig.scopes" Tag="h4" parent="GoogleOidcConfig.">scopes?</NestedTitle>
|
|
220
|
+
<Segment>
|
|
221
|
+
<Section type="parameters">
|
|
222
|
+
<InlineSection>
|
|
223
|
+
**Type** <code class="primitive">string</code><code class="symbol">[]</code>
|
|
224
|
+
</InlineSection>
|
|
225
|
+
</Section>
|
|
226
|
+
A list of OIDC scopes that you want to request.
|
|
227
|
+
```ts
|
|
228
|
+
{
|
|
229
|
+
scopes: ["openid", "profile", "email"]
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
</Segment>
|
|
233
|
+
</div>
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: JumpCloudProvider
|
|
3
|
+
editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/jumpcloud.ts
|
|
4
|
+
description: Reference doc for the `JumpCloudProvider`.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { Segment, Section, NestedTitle, InlineSection } from 'toolbeam-docs-theme/components'
|
|
8
|
+
import { Tabs, TabItem } from '@astrojs/starlight/components'
|
|
9
|
+
|
|
10
|
+
<div class="tsdoc">
|
|
11
|
+
<Section type="about">
|
|
12
|
+
Use this provider to authenticate with JumpCloud.
|
|
13
|
+
|
|
14
|
+
```ts {5-8}
|
|
15
|
+
import { JumpCloudProvider } from "@openauthjs/openauth/provider/jumpcloud"
|
|
16
|
+
|
|
17
|
+
export default issuer({
|
|
18
|
+
providers: {
|
|
19
|
+
jumpcloud: JumpCloudProvider({
|
|
20
|
+
clientID: "1234567890",
|
|
21
|
+
clientSecret: "0987654321"
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
```
|
|
26
|
+
</Section>
|
|
27
|
+
---
|
|
28
|
+
## Methods
|
|
29
|
+
### JumpCloudProvider
|
|
30
|
+
<Segment>
|
|
31
|
+
<Section type="signature">
|
|
32
|
+
```ts
|
|
33
|
+
JumpCloudProvider(config)
|
|
34
|
+
```
|
|
35
|
+
</Section>
|
|
36
|
+
<Section type="parameters">
|
|
37
|
+
#### Parameters
|
|
38
|
+
- <p><code class="key">config</code> [<code class="type">JumpCloudConfig</code>](/docs/provider/jumpcloud#jumpcloudconfig)</p>
|
|
39
|
+
The config for the provider.
|
|
40
|
+
</Section>
|
|
41
|
+
<InlineSection>
|
|
42
|
+
**Returns** <code class="type">Provider</code>
|
|
43
|
+
</InlineSection>
|
|
44
|
+
Create a JumpCloud OAuth2 provider.
|
|
45
|
+
```ts
|
|
46
|
+
JumpCloudProvider({
|
|
47
|
+
clientID: "1234567890",
|
|
48
|
+
clientSecret: "0987654321"
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
</Segment>
|
|
52
|
+
## JumpCloudConfig
|
|
53
|
+
<Segment>
|
|
54
|
+
<Section type="parameters">
|
|
55
|
+
- <p>[<code class="key">clientID</code>](#jumpcloudconfig.clientid) <code class="primitive">string</code></p>
|
|
56
|
+
- <p>[<code class="key">clientSecret</code>](#jumpcloudconfig.clientsecret) <code class="primitive">string</code></p>
|
|
57
|
+
- <p>[<code class="key">pkce?</code>](#jumpcloudconfig.pkce) <code class="primitive">boolean</code></p>
|
|
58
|
+
- <p>[<code class="key">query?</code>](#jumpcloudconfig.query) <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code></p>
|
|
59
|
+
- <p>[<code class="key">scopes</code>](#jumpcloudconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
|
|
60
|
+
</Section>
|
|
61
|
+
</Segment>
|
|
62
|
+
<NestedTitle id="jumpcloudconfig.clientid" Tag="h4" parent="JumpCloudConfig.">clientID</NestedTitle>
|
|
63
|
+
<Segment>
|
|
64
|
+
<Section type="parameters">
|
|
65
|
+
<InlineSection>
|
|
66
|
+
**Type** <code class="primitive">string</code>
|
|
67
|
+
</InlineSection>
|
|
68
|
+
</Section>
|
|
69
|
+
The client ID.
|
|
70
|
+
|
|
71
|
+
This is just a string to identify your app.
|
|
72
|
+
```ts
|
|
73
|
+
{
|
|
74
|
+
clientID: "my-client"
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
</Segment>
|
|
78
|
+
<NestedTitle id="jumpcloudconfig.clientsecret" Tag="h4" parent="JumpCloudConfig.">clientSecret</NestedTitle>
|
|
79
|
+
<Segment>
|
|
80
|
+
<Section type="parameters">
|
|
81
|
+
<InlineSection>
|
|
82
|
+
**Type** <code class="primitive">string</code>
|
|
83
|
+
</InlineSection>
|
|
84
|
+
</Section>
|
|
85
|
+
The client secret.
|
|
86
|
+
|
|
87
|
+
This is a private key that's used to authenticate your app. It should be kept secret.
|
|
88
|
+
```ts
|
|
89
|
+
{
|
|
90
|
+
clientSecret: "0987654321"
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
</Segment>
|
|
94
|
+
<NestedTitle id="jumpcloudconfig.pkce" Tag="h4" parent="JumpCloudConfig.">pkce?</NestedTitle>
|
|
95
|
+
<Segment>
|
|
96
|
+
<Section type="parameters">
|
|
97
|
+
<InlineSection>
|
|
98
|
+
**Type** <code class="primitive">boolean</code>
|
|
99
|
+
</InlineSection>
|
|
100
|
+
</Section>
|
|
101
|
+
|
|
102
|
+
<InlineSection>
|
|
103
|
+
**Default** false
|
|
104
|
+
</InlineSection>
|
|
105
|
+
Whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow.
|
|
106
|
+
Some providers like x.com require this.
|
|
107
|
+
</Segment>
|
|
108
|
+
<NestedTitle id="jumpcloudconfig.query" Tag="h4" parent="JumpCloudConfig.">query?</NestedTitle>
|
|
109
|
+
<Segment>
|
|
110
|
+
<Section type="parameters">
|
|
111
|
+
<InlineSection>
|
|
112
|
+
**Type** <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code>
|
|
113
|
+
</InlineSection>
|
|
114
|
+
</Section>
|
|
115
|
+
Any additional parameters that you want to pass to the authorization endpoint.
|
|
116
|
+
```ts
|
|
117
|
+
{
|
|
118
|
+
query: {
|
|
119
|
+
access_type: "offline",
|
|
120
|
+
prompt: "consent"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
</Segment>
|
|
125
|
+
<NestedTitle id="jumpcloudconfig.scopes" Tag="h4" parent="JumpCloudConfig.">scopes</NestedTitle>
|
|
126
|
+
<Segment>
|
|
127
|
+
<Section type="parameters">
|
|
128
|
+
<InlineSection>
|
|
129
|
+
**Type** <code class="primitive">string</code><code class="symbol">[]</code>
|
|
130
|
+
</InlineSection>
|
|
131
|
+
</Section>
|
|
132
|
+
A list of OAuth scopes that you want to request.
|
|
133
|
+
```ts
|
|
134
|
+
{
|
|
135
|
+
scopes: ["email", "profile"]
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
</Segment>
|
|
139
|
+
</div>
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: KeycloakProvider
|
|
3
|
+
editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/keycloak.ts
|
|
4
|
+
description: Reference doc for the `KeycloakProvider`.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
import { Segment, Section, NestedTitle, InlineSection } from 'toolbeam-docs-theme/components'
|
|
8
|
+
import { Tabs, TabItem } from '@astrojs/starlight/components'
|
|
9
|
+
|
|
10
|
+
<div class="tsdoc">
|
|
11
|
+
<Section type="about">
|
|
12
|
+
Use this provider to authenticate with a Keycloak server.
|
|
13
|
+
|
|
14
|
+
```ts {5-10}
|
|
15
|
+
import { KeycloakProvider } from "@openauthjs/openauth/provider/keycloak"
|
|
16
|
+
|
|
17
|
+
export default issuer({
|
|
18
|
+
providers: {
|
|
19
|
+
keycloak: KeycloakProvider({
|
|
20
|
+
baseUrl: "https://your-keycloak-domain",
|
|
21
|
+
realm: "your-realm",
|
|
22
|
+
clientID: "1234567890",
|
|
23
|
+
clientSecret: "0987654321"
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
</Section>
|
|
29
|
+
---
|
|
30
|
+
## Methods
|
|
31
|
+
### KeycloakProvider
|
|
32
|
+
<Segment>
|
|
33
|
+
<Section type="signature">
|
|
34
|
+
```ts
|
|
35
|
+
KeycloakProvider(config)
|
|
36
|
+
```
|
|
37
|
+
</Section>
|
|
38
|
+
<Section type="parameters">
|
|
39
|
+
#### Parameters
|
|
40
|
+
- <p><code class="key">config</code> [<code class="type">KeycloakConfig</code>](/docs/provider/keycloak#keycloakconfig)</p>
|
|
41
|
+
The config for the provider.
|
|
42
|
+
</Section>
|
|
43
|
+
<InlineSection>
|
|
44
|
+
**Returns** <code class="type">Provider</code>
|
|
45
|
+
</InlineSection>
|
|
46
|
+
Create a Keycloak OAuth2 provider.
|
|
47
|
+
```ts
|
|
48
|
+
KeycloakProvider({
|
|
49
|
+
baseUrl: "https://your-keycloak-domain",
|
|
50
|
+
realm: "your-realm",
|
|
51
|
+
clientID: "1234567890",
|
|
52
|
+
clientSecret: "0987654321"
|
|
53
|
+
})
|
|
54
|
+
```
|
|
55
|
+
</Segment>
|
|
56
|
+
## KeycloakConfig
|
|
57
|
+
<Segment>
|
|
58
|
+
<Section type="parameters">
|
|
59
|
+
- <p>[<code class="key">baseUrl</code>](#keycloakconfig.baseurl) <code class="primitive">string</code></p>
|
|
60
|
+
- <p>[<code class="key">clientID</code>](#keycloakconfig.clientid) <code class="primitive">string</code></p>
|
|
61
|
+
- <p>[<code class="key">clientSecret</code>](#keycloakconfig.clientsecret) <code class="primitive">string</code></p>
|
|
62
|
+
- <p>[<code class="key">pkce?</code>](#keycloakconfig.pkce) <code class="primitive">boolean</code></p>
|
|
63
|
+
- <p>[<code class="key">query?</code>](#keycloakconfig.query) <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code></p>
|
|
64
|
+
- <p>[<code class="key">realm</code>](#keycloakconfig.realm) <code class="primitive">string</code></p>
|
|
65
|
+
- <p>[<code class="key">scopes</code>](#keycloakconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
|
|
66
|
+
</Section>
|
|
67
|
+
</Segment>
|
|
68
|
+
<NestedTitle id="keycloakconfig.baseurl" Tag="h4" parent="KeycloakConfig.">baseUrl</NestedTitle>
|
|
69
|
+
<Segment>
|
|
70
|
+
<Section type="parameters">
|
|
71
|
+
<InlineSection>
|
|
72
|
+
**Type** <code class="primitive">string</code>
|
|
73
|
+
</InlineSection>
|
|
74
|
+
</Section>
|
|
75
|
+
The base URL of the Keycloak server.
|
|
76
|
+
```ts
|
|
77
|
+
{
|
|
78
|
+
baseUrl: "https://your-keycloak-domain"
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
</Segment>
|
|
82
|
+
<NestedTitle id="keycloakconfig.clientid" Tag="h4" parent="KeycloakConfig.">clientID</NestedTitle>
|
|
83
|
+
<Segment>
|
|
84
|
+
<Section type="parameters">
|
|
85
|
+
<InlineSection>
|
|
86
|
+
**Type** <code class="primitive">string</code>
|
|
87
|
+
</InlineSection>
|
|
88
|
+
</Section>
|
|
89
|
+
The client ID.
|
|
90
|
+
|
|
91
|
+
This is just a string to identify your app.
|
|
92
|
+
```ts
|
|
93
|
+
{
|
|
94
|
+
clientID: "my-client"
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
</Segment>
|
|
98
|
+
<NestedTitle id="keycloakconfig.clientsecret" Tag="h4" parent="KeycloakConfig.">clientSecret</NestedTitle>
|
|
99
|
+
<Segment>
|
|
100
|
+
<Section type="parameters">
|
|
101
|
+
<InlineSection>
|
|
102
|
+
**Type** <code class="primitive">string</code>
|
|
103
|
+
</InlineSection>
|
|
104
|
+
</Section>
|
|
105
|
+
The client secret.
|
|
106
|
+
|
|
107
|
+
This is a private key that's used to authenticate your app. It should be kept secret.
|
|
108
|
+
```ts
|
|
109
|
+
{
|
|
110
|
+
clientSecret: "0987654321"
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
</Segment>
|
|
114
|
+
<NestedTitle id="keycloakconfig.pkce" Tag="h4" parent="KeycloakConfig.">pkce?</NestedTitle>
|
|
115
|
+
<Segment>
|
|
116
|
+
<Section type="parameters">
|
|
117
|
+
<InlineSection>
|
|
118
|
+
**Type** <code class="primitive">boolean</code>
|
|
119
|
+
</InlineSection>
|
|
120
|
+
</Section>
|
|
121
|
+
|
|
122
|
+
<InlineSection>
|
|
123
|
+
**Default** false
|
|
124
|
+
</InlineSection>
|
|
125
|
+
Whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow.
|
|
126
|
+
Some providers like x.com require this.
|
|
127
|
+
</Segment>
|
|
128
|
+
<NestedTitle id="keycloakconfig.query" Tag="h4" parent="KeycloakConfig.">query?</NestedTitle>
|
|
129
|
+
<Segment>
|
|
130
|
+
<Section type="parameters">
|
|
131
|
+
<InlineSection>
|
|
132
|
+
**Type** <code class="primitive">Record</code><code class="symbol"><</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">></code>
|
|
133
|
+
</InlineSection>
|
|
134
|
+
</Section>
|
|
135
|
+
Any additional parameters that you want to pass to the authorization endpoint.
|
|
136
|
+
```ts
|
|
137
|
+
{
|
|
138
|
+
query: {
|
|
139
|
+
access_type: "offline",
|
|
140
|
+
prompt: "consent"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
</Segment>
|
|
145
|
+
<NestedTitle id="keycloakconfig.realm" Tag="h4" parent="KeycloakConfig.">realm</NestedTitle>
|
|
146
|
+
<Segment>
|
|
147
|
+
<Section type="parameters">
|
|
148
|
+
<InlineSection>
|
|
149
|
+
**Type** <code class="primitive">string</code>
|
|
150
|
+
</InlineSection>
|
|
151
|
+
</Section>
|
|
152
|
+
The realm in the Keycloak server to authenticate against.
|
|
153
|
+
|
|
154
|
+
A realm in Keycloak is like a tenant or namespace that manages a set of
|
|
155
|
+
users, credentials, roles, and groups.
|
|
156
|
+
```ts
|
|
157
|
+
{
|
|
158
|
+
realm: "your-realm"
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
</Segment>
|
|
162
|
+
<NestedTitle id="keycloakconfig.scopes" Tag="h4" parent="KeycloakConfig.">scopes</NestedTitle>
|
|
163
|
+
<Segment>
|
|
164
|
+
<Section type="parameters">
|
|
165
|
+
<InlineSection>
|
|
166
|
+
**Type** <code class="primitive">string</code><code class="symbol">[]</code>
|
|
167
|
+
</InlineSection>
|
|
168
|
+
</Section>
|
|
169
|
+
A list of OAuth scopes that you want to request.
|
|
170
|
+
```ts
|
|
171
|
+
{
|
|
172
|
+
scopes: ["email", "profile"]
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
</Segment>
|
|
176
|
+
</div>
|