Skip to content

Commit

Permalink
feat(provider): add EVE Online provider (#1227)
Browse files Browse the repository at this point in the history
* 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
geraldm74 and Gerald McNicholl authored Feb 2, 2021
1 parent 562bcf2 commit c387f32
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/providers/eveonline.js
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
}
}
2 changes: 2 additions & 0 deletions src/providers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Cognito from './cognito'
import Credentials from './credentials'
import Discord from './discord'
import Email from './email'
import EVEOnline from './eveonline'
import Facebook from './facebook'
import Foursquare from './foursquare'
import FusionAuth from './fusionauth'
Expand Down Expand Up @@ -46,6 +47,7 @@ export default {
Credentials,
Discord,
Email,
EVEOnline,
Facebook,
Foursquare,
FusionAuth,
Expand Down
57 changes: 57 additions & 0 deletions www/docs/providers/eveonline.md
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;
}
}
}
...
```
1 change: 1 addition & 0 deletions www/providers.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"credentials": "Credentials",
"discord": "Discord",
"email": "Email",
"eveonline": "EVE Online",
"facebook": "Facebook",
"foursquare": "Foursquare",
"fusionauth": "FusionAuth",
Expand Down

0 comments on commit c387f32

Please sign in to comment.