@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.

Files changed (266) hide show
  1. package/.changeset/README.md +8 -0
  2. package/.changeset/commit.cjs +4 -0
  3. package/.changeset/config.json +11 -0
  4. package/.changeset/farms-openauth-release-0-4-3-farms-2.md +10 -0
  5. package/.changeset/popular-geese-reply.md +5 -0
  6. package/.changeset/stupid-boats-play.md +5 -0
  7. package/.changeset/ten-pans-invent.md +5 -0
  8. package/.github/CODE_OF_CONDUCT +15 -0
  9. package/.github/workflows/docs.yml +39 -0
  10. package/.github/workflows/format.yml +26 -0
  11. package/.github/workflows/release.yml +28 -0
  12. package/.github/workflows/test.yml +20 -0
  13. package/.prettierrc +3 -0
  14. package/CNAME +1 -0
  15. package/FARMS_RELEASE.md +82 -0
  16. package/LICENSE +22 -0
  17. package/PATCHES.md +32 -0
  18. package/README.md +311 -0
  19. package/bun.lockb +0 -0
  20. package/bunfig.toml +2 -0
  21. package/examples/README.md +28 -0
  22. package/examples/client/astro/.vscode/extensions.json +4 -0
  23. package/examples/client/astro/.vscode/launch.json +11 -0
  24. package/examples/client/astro/README.md +7 -0
  25. package/examples/client/astro/astro.config.mjs +10 -0
  26. package/examples/client/astro/package.json +15 -0
  27. package/examples/client/astro/public/favicon.svg +9 -0
  28. package/examples/client/astro/src/assets/astro.svg +1 -0
  29. package/examples/client/astro/src/assets/background.svg +1 -0
  30. package/examples/client/astro/src/auth.ts +23 -0
  31. package/examples/client/astro/src/components/Welcome.astro +209 -0
  32. package/examples/client/astro/src/env.d.ts +10 -0
  33. package/examples/client/astro/src/layouts/Layout.astro +22 -0
  34. package/examples/client/astro/src/middleware.ts +31 -0
  35. package/examples/client/astro/src/pages/callback.ts +19 -0
  36. package/examples/client/astro/src/pages/index.astro +11 -0
  37. package/examples/client/astro/tsconfig.json +5 -0
  38. package/examples/client/cloudflare-api/api.ts +80 -0
  39. package/examples/client/cloudflare-api/package.json +5 -0
  40. package/examples/client/jwt-api/CHANGELOG.md +8 -0
  41. package/examples/client/jwt-api/README.md +13 -0
  42. package/examples/client/jwt-api/index.ts +45 -0
  43. package/examples/client/jwt-api/package.json +15 -0
  44. package/examples/client/lambda-api/api.ts +69 -0
  45. package/examples/client/lambda-api/package.json +5 -0
  46. package/examples/client/nextjs/CHANGELOG.md +46 -0
  47. package/examples/client/nextjs/README.md +26 -0
  48. package/examples/client/nextjs/app/actions.ts +61 -0
  49. package/examples/client/nextjs/app/api/callback/route.ts +11 -0
  50. package/examples/client/nextjs/app/auth.ts +29 -0
  51. package/examples/client/nextjs/app/favicon.ico +0 -0
  52. package/examples/client/nextjs/app/globals.css +42 -0
  53. package/examples/client/nextjs/app/layout.tsx +32 -0
  54. package/examples/client/nextjs/app/page.module.css +169 -0
  55. package/examples/client/nextjs/app/page.tsx +97 -0
  56. package/examples/client/nextjs/next.config.ts +7 -0
  57. package/examples/client/nextjs/package.json +23 -0
  58. package/examples/client/nextjs/public/file.svg +1 -0
  59. package/examples/client/nextjs/public/globe.svg +1 -0
  60. package/examples/client/nextjs/public/next.svg +1 -0
  61. package/examples/client/nextjs/public/vercel.svg +1 -0
  62. package/examples/client/nextjs/public/window.svg +1 -0
  63. package/examples/client/nextjs/tsconfig.json +27 -0
  64. package/examples/client/react/README.md +29 -0
  65. package/examples/client/react/index.html +13 -0
  66. package/examples/client/react/package.json +30 -0
  67. package/examples/client/react/public/vite.svg +1 -0
  68. package/examples/client/react/src/App.tsx +39 -0
  69. package/examples/client/react/src/AuthContext.tsx +153 -0
  70. package/examples/client/react/src/assets/react.svg +1 -0
  71. package/examples/client/react/src/main.tsx +12 -0
  72. package/examples/client/react/src/vite-env.d.ts +1 -0
  73. package/examples/client/react/tsconfig.app.json +26 -0
  74. package/examples/client/react/tsconfig.json +11 -0
  75. package/examples/client/react/tsconfig.node.json +24 -0
  76. package/examples/client/react/vite.config.ts +7 -0
  77. package/examples/client/sveltekit/package.json +24 -0
  78. package/examples/client/sveltekit/src/app.d.ts +15 -0
  79. package/examples/client/sveltekit/src/app.html +12 -0
  80. package/examples/client/sveltekit/src/hooks.server.ts +29 -0
  81. package/examples/client/sveltekit/src/lib/auth.server.ts +29 -0
  82. package/examples/client/sveltekit/src/routes/+page.server.ts +5 -0
  83. package/examples/client/sveltekit/src/routes/+page.svelte +5 -0
  84. package/examples/client/sveltekit/src/routes/callback/+server.ts +17 -0
  85. package/examples/client/sveltekit/static/favicon.png +0 -0
  86. package/examples/client/sveltekit/svelte.config.js +18 -0
  87. package/examples/client/sveltekit/tsconfig.json +19 -0
  88. package/examples/client/sveltekit/vite.config.ts +6 -0
  89. package/examples/issuer/bun/issuer.ts +43 -0
  90. package/examples/issuer/bun/package.json +7 -0
  91. package/examples/issuer/cloudflare/issuer.ts +47 -0
  92. package/examples/issuer/cloudflare/package.json +8 -0
  93. package/examples/issuer/cloudflare/sst-env.d.ts +17 -0
  94. package/examples/issuer/cloudflare/sst.config.ts +23 -0
  95. package/examples/issuer/custom-frontend/auth/issuer.ts +43 -0
  96. package/examples/issuer/custom-frontend/auth/package.json +7 -0
  97. package/examples/issuer/custom-frontend/frontend/frontend.tsx +57 -0
  98. package/examples/issuer/custom-frontend/frontend/package.json +6 -0
  99. package/examples/issuer/custom-frontend/package.json +5 -0
  100. package/examples/issuer/lambda/issuer.ts +35 -0
  101. package/examples/issuer/lambda/package.json +8 -0
  102. package/examples/issuer/lambda/sst-env.d.ts +9 -0
  103. package/examples/issuer/lambda/sst.config.ts +15 -0
  104. package/examples/issuer/node/authorizer.ts +38 -0
  105. package/examples/issuer/node/package.json +5 -0
  106. package/examples/quickstart/sst/README.md +36 -0
  107. package/examples/quickstart/sst/app/actions.ts +62 -0
  108. package/examples/quickstart/sst/app/api/callback/route.ts +15 -0
  109. package/examples/quickstart/sst/app/auth.ts +29 -0
  110. package/examples/quickstart/sst/app/favicon.ico +0 -0
  111. package/examples/quickstart/sst/app/globals.css +42 -0
  112. package/examples/quickstart/sst/app/layout.tsx +32 -0
  113. package/examples/quickstart/sst/app/page.module.css +200 -0
  114. package/examples/quickstart/sst/app/page.tsx +53 -0
  115. package/examples/quickstart/sst/auth/index.ts +37 -0
  116. package/examples/quickstart/sst/auth/subjects.ts +8 -0
  117. package/examples/quickstart/sst/next.config.ts +7 -0
  118. package/examples/quickstart/sst/package-lock.json +1165 -0
  119. package/examples/quickstart/sst/package.json +26 -0
  120. package/examples/quickstart/sst/public/file.svg +1 -0
  121. package/examples/quickstart/sst/public/globe.svg +1 -0
  122. package/examples/quickstart/sst/public/next.svg +1 -0
  123. package/examples/quickstart/sst/public/vercel.svg +1 -0
  124. package/examples/quickstart/sst/public/window.svg +1 -0
  125. package/examples/quickstart/sst/sst-env.d.ts +18 -0
  126. package/examples/quickstart/sst/sst.config.ts +21 -0
  127. package/examples/quickstart/sst/tsconfig.json +27 -0
  128. package/examples/quickstart/standalone/README.md +36 -0
  129. package/examples/quickstart/standalone/app/actions.ts +62 -0
  130. package/examples/quickstart/standalone/app/api/callback/route.ts +15 -0
  131. package/examples/quickstart/standalone/app/auth.ts +28 -0
  132. package/examples/quickstart/standalone/app/favicon.ico +0 -0
  133. package/examples/quickstart/standalone/app/globals.css +42 -0
  134. package/examples/quickstart/standalone/app/layout.tsx +32 -0
  135. package/examples/quickstart/standalone/app/page.module.css +200 -0
  136. package/examples/quickstart/standalone/app/page.tsx +53 -0
  137. package/examples/quickstart/standalone/auth/index.ts +32 -0
  138. package/examples/quickstart/standalone/auth/subjects.ts +8 -0
  139. package/examples/quickstart/standalone/bun.lockb +0 -0
  140. package/examples/quickstart/standalone/next.config.ts +7 -0
  141. package/examples/quickstart/standalone/package.json +25 -0
  142. package/examples/quickstart/standalone/public/file.svg +1 -0
  143. package/examples/quickstart/standalone/public/globe.svg +1 -0
  144. package/examples/quickstart/standalone/public/next.svg +1 -0
  145. package/examples/quickstart/standalone/public/vercel.svg +1 -0
  146. package/examples/quickstart/standalone/public/window.svg +1 -0
  147. package/examples/quickstart/standalone/tsconfig.json +27 -0
  148. package/examples/subjects.ts +8 -0
  149. package/examples/tsconfig.json +10 -0
  150. package/package.json +23 -0
  151. package/packages/openauth/CHANGELOG.md +310 -0
  152. package/packages/openauth/bunfig.toml +2 -0
  153. package/packages/openauth/package.json +51 -0
  154. package/packages/openauth/script/build.ts +25 -0
  155. package/packages/openauth/src/client-native.ts +204 -0
  156. package/packages/openauth/src/client.ts +776 -0
  157. package/packages/openauth/src/css.d.ts +4 -0
  158. package/packages/openauth/src/error.ts +120 -0
  159. package/packages/openauth/src/index.ts +26 -0
  160. package/packages/openauth/src/issuer.ts +1156 -0
  161. package/packages/openauth/src/jwt.ts +17 -0
  162. package/packages/openauth/src/keys.ts +139 -0
  163. package/packages/openauth/src/pkce.ts +40 -0
  164. package/packages/openauth/src/provider/apple.ts +127 -0
  165. package/packages/openauth/src/provider/arctic.ts +66 -0
  166. package/packages/openauth/src/provider/code.ts +227 -0
  167. package/packages/openauth/src/provider/cognito.ts +74 -0
  168. package/packages/openauth/src/provider/discord.ts +45 -0
  169. package/packages/openauth/src/provider/facebook.ts +84 -0
  170. package/packages/openauth/src/provider/github.ts +45 -0
  171. package/packages/openauth/src/provider/google.ts +85 -0
  172. package/packages/openauth/src/provider/index.ts +3 -0
  173. package/packages/openauth/src/provider/jumpcloud.ts +45 -0
  174. package/packages/openauth/src/provider/keycloak.ts +75 -0
  175. package/packages/openauth/src/provider/linkedin.ts +12 -0
  176. package/packages/openauth/src/provider/microsoft.ts +100 -0
  177. package/packages/openauth/src/provider/oauth2.ts +297 -0
  178. package/packages/openauth/src/provider/oidc.ts +179 -0
  179. package/packages/openauth/src/provider/password.ts +672 -0
  180. package/packages/openauth/src/provider/provider.ts +33 -0
  181. package/packages/openauth/src/provider/slack.ts +67 -0
  182. package/packages/openauth/src/provider/spotify.ts +45 -0
  183. package/packages/openauth/src/provider/twitch.ts +45 -0
  184. package/packages/openauth/src/provider/x.ts +46 -0
  185. package/packages/openauth/src/provider/yahoo.ts +45 -0
  186. package/packages/openauth/src/random.ts +28 -0
  187. package/packages/openauth/src/storage/aws.ts +59 -0
  188. package/packages/openauth/src/storage/cloudflare.ts +77 -0
  189. package/packages/openauth/src/storage/dynamo.ts +193 -0
  190. package/packages/openauth/src/storage/memory.ts +135 -0
  191. package/packages/openauth/src/storage/storage.ts +46 -0
  192. package/packages/openauth/src/subject.ts +130 -0
  193. package/packages/openauth/src/ui/base.tsx +118 -0
  194. package/packages/openauth/src/ui/code.tsx +212 -0
  195. package/packages/openauth/src/ui/form.tsx +40 -0
  196. package/packages/openauth/src/ui/icon.tsx +95 -0
  197. package/packages/openauth/src/ui/password.tsx +403 -0
  198. package/packages/openauth/src/ui/select.tsx +221 -0
  199. package/packages/openauth/src/ui/theme.ts +319 -0
  200. package/packages/openauth/src/ui/ui.css +252 -0
  201. package/packages/openauth/src/util.ts +58 -0
  202. package/packages/openauth/test/client-native.test.ts +30 -0
  203. package/packages/openauth/test/client.test.ts +177 -0
  204. package/packages/openauth/test/issuer.test.ts +393 -0
  205. package/packages/openauth/test/scrap.test.ts +85 -0
  206. package/packages/openauth/test/storage.test.ts +94 -0
  207. package/packages/openauth/test/util.test.ts +103 -0
  208. package/packages/openauth/tsconfig.json +13 -0
  209. package/scripts/format +15 -0
  210. package/www/.vscode/extensions.json +4 -0
  211. package/www/.vscode/launch.json +11 -0
  212. package/www/README.md +55 -0
  213. package/www/astro.config.mjs +136 -0
  214. package/www/bun.lockb +0 -0
  215. package/www/config.ts +4 -0
  216. package/www/generate.ts +911 -0
  217. package/www/package.json +24 -0
  218. package/www/public/favicon-dark.svg +3 -0
  219. package/www/public/favicon.ico +0 -0
  220. package/www/public/favicon.svg +3 -0
  221. package/www/public/social-share.png +0 -0
  222. package/www/src/assets/logo-dark.svg +11 -0
  223. package/www/src/assets/logo-light.svg +11 -0
  224. package/www/src/components/Hero.astro +11 -0
  225. package/www/src/components/Lander.astro +176 -0
  226. package/www/src/content/config.ts +6 -0
  227. package/www/src/content/docs/docs/client.mdx +650 -0
  228. package/www/src/content/docs/docs/index.mdx +325 -0
  229. package/www/src/content/docs/docs/issuer.mdx +512 -0
  230. package/www/src/content/docs/docs/provider/apple.mdx +233 -0
  231. package/www/src/content/docs/docs/provider/code.mdx +163 -0
  232. package/www/src/content/docs/docs/provider/cognito.mdx +173 -0
  233. package/www/src/content/docs/docs/provider/discord.mdx +139 -0
  234. package/www/src/content/docs/docs/provider/facebook.mdx +233 -0
  235. package/www/src/content/docs/docs/provider/github.mdx +139 -0
  236. package/www/src/content/docs/docs/provider/google.mdx +233 -0
  237. package/www/src/content/docs/docs/provider/jumpcloud.mdx +139 -0
  238. package/www/src/content/docs/docs/provider/keycloak.mdx +176 -0
  239. package/www/src/content/docs/docs/provider/microsoft.mdx +252 -0
  240. package/www/src/content/docs/docs/provider/oauth2.mdx +173 -0
  241. package/www/src/content/docs/docs/provider/oidc.mdx +113 -0
  242. package/www/src/content/docs/docs/provider/password.mdx +237 -0
  243. package/www/src/content/docs/docs/provider/slack.mdx +157 -0
  244. package/www/src/content/docs/docs/provider/spotify.mdx +139 -0
  245. package/www/src/content/docs/docs/provider/twitch.mdx +139 -0
  246. package/www/src/content/docs/docs/provider/x.mdx +139 -0
  247. package/www/src/content/docs/docs/provider/yahoo.mdx +139 -0
  248. package/www/src/content/docs/docs/start/nextjs-dark.png +0 -0
  249. package/www/src/content/docs/docs/start/nextjs-light.png +0 -0
  250. package/www/src/content/docs/docs/start/sst.mdx +423 -0
  251. package/www/src/content/docs/docs/start/standalone.mdx +376 -0
  252. package/www/src/content/docs/docs/storage/cloudflare.mdx +63 -0
  253. package/www/src/content/docs/docs/storage/dynamo.mdx +127 -0
  254. package/www/src/content/docs/docs/storage/memory.mdx +77 -0
  255. package/www/src/content/docs/docs/subject.mdx +139 -0
  256. package/www/src/content/docs/docs/themes-dark.png +0 -0
  257. package/www/src/content/docs/docs/themes-light.png +0 -0
  258. package/www/src/content/docs/docs/ui/code.mdx +248 -0
  259. package/www/src/content/docs/docs/ui/password.mdx +410 -0
  260. package/www/src/content/docs/docs/ui/select.mdx +99 -0
  261. package/www/src/content/docs/docs/ui/theme.mdx +284 -0
  262. package/www/src/content/docs/index.mdx +12 -0
  263. package/www/src/custom.css +0 -0
  264. package/www/src/env.d.ts +2 -0
  265. package/www/src/styles/lander.css +15 -0
  266. package/www/tsconfig.json +3 -0
@@ -0,0 +1,139 @@
1
+ ---
2
+ title: DiscordProvider
3
+ editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/discord.ts
4
+ description: Reference doc for the `DiscordProvider`.
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 Discord.
13
+
14
+ ```ts {5-8}
15
+ import { DiscordProvider } from "@openauthjs/openauth/provider/discord"
16
+
17
+ export default issuer({
18
+ providers: {
19
+ discord: DiscordProvider({
20
+ clientID: "1234567890",
21
+ clientSecret: "0987654321"
22
+ })
23
+ }
24
+ })
25
+ ```
26
+ </Section>
27
+ ---
28
+ ## Methods
29
+ ### DiscordProvider
30
+ <Segment>
31
+ <Section type="signature">
32
+ ```ts
33
+ DiscordProvider(config)
34
+ ```
35
+ </Section>
36
+ <Section type="parameters">
37
+ #### Parameters
38
+ - <p><code class="key">config</code> [<code class="type">DiscordConfig</code>](/docs/provider/discord#discordconfig)</p>
39
+ The config for the provider.
40
+ </Section>
41
+ <InlineSection>
42
+ **Returns** <code class="type">Provider</code>
43
+ </InlineSection>
44
+ Create a Discord OAuth2 provider.
45
+ ```ts
46
+ DiscordProvider({
47
+ clientID: "1234567890",
48
+ clientSecret: "0987654321"
49
+ })
50
+ ```
51
+ </Segment>
52
+ ## DiscordConfig
53
+ <Segment>
54
+ <Section type="parameters">
55
+ - <p>[<code class="key">clientID</code>](#discordconfig.clientid) <code class="primitive">string</code></p>
56
+ - <p>[<code class="key">clientSecret</code>](#discordconfig.clientsecret) <code class="primitive">string</code></p>
57
+ - <p>[<code class="key">pkce?</code>](#discordconfig.pkce) <code class="primitive">boolean</code></p>
58
+ - <p>[<code class="key">query?</code>](#discordconfig.query) <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code></p>
59
+ - <p>[<code class="key">scopes</code>](#discordconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
60
+ </Section>
61
+ </Segment>
62
+ <NestedTitle id="discordconfig.clientid" Tag="h4" parent="DiscordConfig.">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="discordconfig.clientsecret" Tag="h4" parent="DiscordConfig.">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="discordconfig.pkce" Tag="h4" parent="DiscordConfig.">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="discordconfig.query" Tag="h4" parent="DiscordConfig.">query?</NestedTitle>
109
+ <Segment>
110
+ <Section type="parameters">
111
+ <InlineSection>
112
+ **Type** <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</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="discordconfig.scopes" Tag="h4" parent="DiscordConfig.">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,233 @@
1
+ ---
2
+ title: FacebookProvider
3
+ editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/facebook.ts
4
+ description: Reference doc for the `FacebookProvider`.
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 Facebook. Supports both OAuth2 and OIDC.
13
+
14
+ #### Using OAuth
15
+
16
+ ```ts {5-8}
17
+ import { FacebookProvider } from "@openauthjs/openauth/provider/facebook"
18
+
19
+ export default issuer({
20
+ providers: {
21
+ facebook: FacebookProvider({
22
+ clientID: "1234567890",
23
+ clientSecret: "0987654321"
24
+ })
25
+ }
26
+ })
27
+ ```
28
+
29
+ #### Using OIDC
30
+
31
+ ```ts {5-7}
32
+ import { FacebookOidcProvider } from "@openauthjs/openauth/provider/facebook"
33
+
34
+ export default issuer({
35
+ providers: {
36
+ facebook: FacebookOidcProvider({
37
+ clientID: "1234567890"
38
+ })
39
+ }
40
+ })
41
+ ```
42
+ </Section>
43
+ ---
44
+ ## Methods
45
+ ### FacebookOidcProvider
46
+ <Segment>
47
+ <Section type="signature">
48
+ ```ts
49
+ FacebookOidcProvider(config)
50
+ ```
51
+ </Section>
52
+ <Section type="parameters">
53
+ #### Parameters
54
+ - <p><code class="key">config</code> [<code class="type">FacebookOidcConfig</code>](/docs/provider/facebook#facebookoidcconfig)</p>
55
+ The config for the provider.
56
+ </Section>
57
+ <InlineSection>
58
+ **Returns** <code class="type">Provider</code>
59
+ </InlineSection>
60
+ Create a Facebook OIDC provider.
61
+
62
+ This is useful if you just want to verify the user's email address.
63
+ ```ts
64
+ FacebookOidcProvider({
65
+ clientID: "1234567890"
66
+ })
67
+ ```
68
+ </Segment>
69
+ ### FacebookProvider
70
+ <Segment>
71
+ <Section type="signature">
72
+ ```ts
73
+ FacebookProvider(config)
74
+ ```
75
+ </Section>
76
+ <Section type="parameters">
77
+ #### Parameters
78
+ - <p><code class="key">config</code> [<code class="type">FacebookConfig</code>](/docs/provider/facebook#facebookconfig)</p>
79
+ The config for the provider.
80
+ </Section>
81
+ <InlineSection>
82
+ **Returns** <code class="type">Provider</code>
83
+ </InlineSection>
84
+ Create a Facebook OAuth2 provider.
85
+ ```ts
86
+ FacebookProvider({
87
+ clientID: "1234567890",
88
+ clientSecret: "0987654321"
89
+ })
90
+ ```
91
+ </Segment>
92
+ ## FacebookConfig
93
+ <Segment>
94
+ <Section type="parameters">
95
+ - <p>[<code class="key">clientID</code>](#facebookconfig.clientid) <code class="primitive">string</code></p>
96
+ - <p>[<code class="key">clientSecret</code>](#facebookconfig.clientsecret) <code class="primitive">string</code></p>
97
+ - <p>[<code class="key">pkce?</code>](#facebookconfig.pkce) <code class="primitive">boolean</code></p>
98
+ - <p>[<code class="key">query?</code>](#facebookconfig.query) <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code></p>
99
+ - <p>[<code class="key">scopes</code>](#facebookconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
100
+ </Section>
101
+ </Segment>
102
+ <NestedTitle id="facebookconfig.clientid" Tag="h4" parent="FacebookConfig.">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="facebookconfig.clientsecret" Tag="h4" parent="FacebookConfig.">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="facebookconfig.pkce" Tag="h4" parent="FacebookConfig.">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="facebookconfig.query" Tag="h4" parent="FacebookConfig.">query?</NestedTitle>
149
+ <Segment>
150
+ <Section type="parameters">
151
+ <InlineSection>
152
+ **Type** <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</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="facebookconfig.scopes" Tag="h4" parent="FacebookConfig.">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
+ ## FacebookOidcConfig
180
+ <Segment>
181
+ <Section type="parameters">
182
+ - <p>[<code class="key">clientID</code>](#facebookoidcconfig.clientid) <code class="primitive">string</code></p>
183
+ - <p>[<code class="key">query?</code>](#facebookoidcconfig.query) <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code></p>
184
+ - <p>[<code class="key">scopes?</code>](#facebookoidcconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
185
+ </Section>
186
+ </Segment>
187
+ <NestedTitle id="facebookoidcconfig.clientid" Tag="h4" parent="FacebookOidcConfig.">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="facebookoidcconfig.query" Tag="h4" parent="FacebookOidcConfig.">query?</NestedTitle>
204
+ <Segment>
205
+ <Section type="parameters">
206
+ <InlineSection>
207
+ **Type** <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</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="facebookoidcconfig.scopes" Tag="h4" parent="FacebookOidcConfig.">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: GithubProvider
3
+ editUrl: https://github.com/toolbeam/openauth/blob/master/packages/openauth/src/provider/github.ts
4
+ description: Reference doc for the `GithubProvider`.
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 Github.
13
+
14
+ ```ts {5-8}
15
+ import { GithubProvider } from "@openauthjs/openauth/provider/github"
16
+
17
+ export default issuer({
18
+ providers: {
19
+ github: GithubProvider({
20
+ clientID: "1234567890",
21
+ clientSecret: "0987654321"
22
+ })
23
+ }
24
+ })
25
+ ```
26
+ </Section>
27
+ ---
28
+ ## Methods
29
+ ### GithubProvider
30
+ <Segment>
31
+ <Section type="signature">
32
+ ```ts
33
+ GithubProvider(config)
34
+ ```
35
+ </Section>
36
+ <Section type="parameters">
37
+ #### Parameters
38
+ - <p><code class="key">config</code> [<code class="type">GithubConfig</code>](/docs/provider/github#githubconfig)</p>
39
+ The config for the provider.
40
+ </Section>
41
+ <InlineSection>
42
+ **Returns** <code class="type">Provider</code>
43
+ </InlineSection>
44
+ Create a Github OAuth2 provider.
45
+ ```ts
46
+ GithubProvider({
47
+ clientID: "1234567890",
48
+ clientSecret: "0987654321"
49
+ })
50
+ ```
51
+ </Segment>
52
+ ## GithubConfig
53
+ <Segment>
54
+ <Section type="parameters">
55
+ - <p>[<code class="key">clientID</code>](#githubconfig.clientid) <code class="primitive">string</code></p>
56
+ - <p>[<code class="key">clientSecret</code>](#githubconfig.clientsecret) <code class="primitive">string</code></p>
57
+ - <p>[<code class="key">pkce?</code>](#githubconfig.pkce) <code class="primitive">boolean</code></p>
58
+ - <p>[<code class="key">query?</code>](#githubconfig.query) <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</code></p>
59
+ - <p>[<code class="key">scopes</code>](#githubconfig.scopes) <code class="primitive">string</code><code class="symbol">[]</code></p>
60
+ </Section>
61
+ </Segment>
62
+ <NestedTitle id="githubconfig.clientid" Tag="h4" parent="GithubConfig.">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="githubconfig.clientsecret" Tag="h4" parent="GithubConfig.">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="githubconfig.pkce" Tag="h4" parent="GithubConfig.">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="githubconfig.query" Tag="h4" parent="GithubConfig.">query?</NestedTitle>
109
+ <Segment>
110
+ <Section type="parameters">
111
+ <InlineSection>
112
+ **Type** <code class="primitive">Record</code><code class="symbol">&lt;</code><code class="primitive">string</code>, <code class="primitive">string</code><code class="symbol">&gt;</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="githubconfig.scopes" Tag="h4" parent="GithubConfig.">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>