Skip to content

Commit

Permalink
feat(provider): add FACEIT provider (#1469)
Browse files Browse the repository at this point in the history
  • Loading branch information
thclaude committed Mar 15, 2021
1 parent e31db17 commit 3726d68
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/providers/faceit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default (options) => {
return {
id: 'faceit',
name: 'FACEIT',
type: 'oauth',
version: '2.0',
params: { grant_type: 'authorization_code' },
headers: {
Authorization: `Basic ${Buffer.from(`${options.clientId}:${options.clientSecret}`).toString('base64')}`
},
accessTokenUrl: 'https://api.faceit.com/auth/v1/oauth/token',
authorizationUrl: 'https://accounts.faceit.com/accounts?redirect_popup=true&response_type=code',
profileUrl: 'https://api.faceit.com/auth/v1/resources/userinfo',
profile (profile) {
const { guid: id, nickname: name, email, picture: image } = profile
return {
id,
name,
email,
image
}
},
...options
}
}
2 changes: 2 additions & 0 deletions src/providers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Discord from './discord'
import Email from './email'
import EVEOnline from './eveonline'
import Facebook from './facebook'
import FACEIT from './faceit'
import Foursquare from './foursquare'
import FusionAuth from './fusionauth'
import GitHub from './github'
Expand Down Expand Up @@ -52,6 +53,7 @@ export default {
Email,
EVEOnline,
Facebook,
FACEIT,
Foursquare,
FusionAuth,
GitHub,
Expand Down
30 changes: 30 additions & 0 deletions www/docs/providers/faceit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
id: faceit
title: FACEIT
---

## Documentation

https://cdn.faceit.com/third_party/docs/FACEIT_Connect_3.0.pdf

## Configuration

https://developers.faceit.com/apps

Grant type: `Authorization Code`

Scopes to have basic infos (email, nickname, guid and avatar) : `openid`, `email`, `profile`

## Example

```js
import Providers from `next-auth/providers`
...
providers: [
Providers.FACEIT({
clientId: process.env.FACEIT_CLIENT_ID,
clientSecret: process.env.FACEIT_CLIENT_SECRET
})
]
...
```

1 comment on commit 3726d68

@vercel
Copy link

@vercel vercel bot commented on 3726d68 Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.