Skip to content

Commit d04ce29

Browse files
i-palindrome-iAdam Kaczmarekbalazsorban44
authored
feat(provider): add WorkOS provider (#1939)
* feat(provider): add WorkOS provider * Update www/docs/providers/workos.md Co-authored-by: Balázs Orbán <[email protected]> * Update workos.md Co-authored-by: Adam Kaczmarek <[email protected]> Co-authored-by: Balázs Orbán <[email protected]>
1 parent d2882f1 commit d04ce29

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

src/providers/workos.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
export default function WorkOS(options) {
2+
return {
3+
id: 'workos',
4+
name: 'WorkOS',
5+
type: 'oauth',
6+
version: '2.0',
7+
scope: '',
8+
params: {
9+
grant_type: 'authorization_code',
10+
client_id: options.clientId,
11+
client_secret: options.clientSecret
12+
},
13+
accessTokenUrl: 'https://api.workos.com/sso/token/',
14+
authorizationUrl: `https://api.workos.com/sso/authorize/?response_type=code&domain=${options.domain}`,
15+
profileUrl: 'https://api.workos.com/sso/profile/',
16+
profile: (profile) => {
17+
return {
18+
...profile,
19+
name: `${profile.first_name} ${profile.last_name}`
20+
}
21+
},
22+
...options
23+
}
24+
}

types/providers.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ export type OAuthProviderType =
9494
| "Twitter"
9595
| "VK"
9696
| "WordPress"
97+
| "WorkOS"
9798
| "Yandex"
9899
| "Zoho"
99100

www/docs/providers/workos.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
id: workos
3+
title: WorkOS
4+
---
5+
6+
## Documentation
7+
8+
https://workos.com/docs/sso/guide
9+
10+
## Options
11+
12+
The **WorkOS Provider** comes with a set of default options:
13+
14+
- [WorkOS Provider options](https://github.com/nextauthjs/next-auth/blob/main/src/providers/workos.js)
15+
16+
You can override any of the options to suit your own use case.
17+
18+
## Example
19+
20+
```js
21+
import Providers from `next-auth/providers`
22+
...
23+
providers: [
24+
Providers.WorkOS({
25+
clientId: process.env.WORKOS_ID,
26+
clientSecret: process.env.WORKOS_SECRET,
27+
domain: process.env.WORKOS_DOMAIN
28+
}),
29+
],
30+
...
31+
```

0 commit comments

Comments
 (0)