Skip to content

Commit 3726d68

Browse files
authored
feat(provider): add FACEIT provider (#1469)
1 parent e31db17 commit 3726d68

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

src/providers/faceit.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export default (options) => {
2+
return {
3+
id: 'faceit',
4+
name: 'FACEIT',
5+
type: 'oauth',
6+
version: '2.0',
7+
params: { grant_type: 'authorization_code' },
8+
headers: {
9+
Authorization: `Basic ${Buffer.from(`${options.clientId}:${options.clientSecret}`).toString('base64')}`
10+
},
11+
accessTokenUrl: 'https://api.faceit.com/auth/v1/oauth/token',
12+
authorizationUrl: 'https://accounts.faceit.com/accounts?redirect_popup=true&response_type=code',
13+
profileUrl: 'https://api.faceit.com/auth/v1/resources/userinfo',
14+
profile (profile) {
15+
const { guid: id, nickname: name, email, picture: image } = profile
16+
return {
17+
id,
18+
name,
19+
email,
20+
image
21+
}
22+
},
23+
...options
24+
}
25+
}

src/providers/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Discord from './discord'
1212
import Email from './email'
1313
import EVEOnline from './eveonline'
1414
import Facebook from './facebook'
15+
import FACEIT from './faceit'
1516
import Foursquare from './foursquare'
1617
import FusionAuth from './fusionauth'
1718
import GitHub from './github'
@@ -52,6 +53,7 @@ export default {
5253
Email,
5354
EVEOnline,
5455
Facebook,
56+
FACEIT,
5557
Foursquare,
5658
FusionAuth,
5759
GitHub,

www/docs/providers/faceit.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
id: faceit
3+
title: FACEIT
4+
---
5+
6+
## Documentation
7+
8+
https://cdn.faceit.com/third_party/docs/FACEIT_Connect_3.0.pdf
9+
10+
## Configuration
11+
12+
https://developers.faceit.com/apps
13+
14+
Grant type: `Authorization Code`
15+
16+
Scopes to have basic infos (email, nickname, guid and avatar) : `openid`, `email`, `profile`
17+
18+
## Example
19+
20+
```js
21+
import Providers from `next-auth/providers`
22+
...
23+
providers: [
24+
Providers.FACEIT({
25+
clientId: process.env.FACEIT_CLIENT_ID,
26+
clientSecret: process.env.FACEIT_CLIENT_SECRET
27+
})
28+
]
29+
...
30+
```

0 commit comments

Comments
 (0)