-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(provider): add EVE Online provider (#1227)
* Adding EVEOnline provider * Adding EVEOnline provider * Adding EVEOnline provider * Adding EVEOnline provider * Adding EVEOnline provider * Adding EVEOnline provider * Adding EVEOnline provider * Adding EVEOnline provider Co-authored-by: Gerald McNicholl <[email protected]>
- Loading branch information
Showing
4 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export default (options) => { | ||
return { | ||
id: 'eveonline', | ||
name: 'EVE Online', | ||
type: 'oauth', | ||
version: '2.0', | ||
params: { grant_type: 'authorization_code' }, | ||
accessTokenUrl: 'https://login.eveonline.com/oauth/token', | ||
authorizationUrl: 'https://login.eveonline.com/oauth/authorize?response_type=code', | ||
profileUrl: 'https://login.eveonline.com/oauth/verify', | ||
profile: (profile) => { | ||
return { | ||
id: profile.CharacterID, | ||
name: profile.CharacterName, | ||
image: `https://image.eveonline.com/Character/${profile.CharacterID}_128.jpg`, | ||
email: null | ||
} | ||
}, | ||
...options | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
id: eveonline | ||
title: EVE Online | ||
--- | ||
|
||
## Documentation | ||
|
||
https://developers.eveonline.com/blog/article/sso-to-authenticated-calls | ||
|
||
## Configuration | ||
|
||
https://developers.eveonline.com/ | ||
|
||
## Example | ||
|
||
```js | ||
import Providers from `next-auth/providers` | ||
... | ||
providers: [ | ||
Providers.EVEOnline({ | ||
clientId: process.env.EVE_CLIENT_ID, | ||
clientSecret: process.env.EVE_CLIENT_SECRET | ||
}) | ||
] | ||
... | ||
``` | ||
|
||
:::tip When creating your application, make sure to select `Authentication Only` as the connection type. | ||
|
||
:::tip If using JWT for the session, you can add the `CharacterID` to the JWT token and session. Example: | ||
|
||
```js | ||
... | ||
options: { | ||
jwt: { | ||
secret: process.env.JWT_SECRET, | ||
}, | ||
callbacks: { | ||
jwt: async (token, user, account, profile, isNewUser) => { | ||
if (profile) { | ||
token = { | ||
...token, | ||
id: profile.CharacterID, | ||
} | ||
} | ||
return token; | ||
}, | ||
session: async (session, token) => { | ||
if (token) { | ||
session.user.id = token.id; | ||
} | ||
return session; | ||
} | ||
} | ||
} | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters