Compare commits

...

2 Commits

Author SHA1 Message Date
Mohamed Ouyizme
7f39669053 feat(provider): add 42 School provider (#1872)
* feat(provider): add 42 School provider

* fix(docs): fix provider import

Co-authored-by: Balázs Orbán <info@balazsorban.com>

* fix(provider): change provider id

Co-authored-by: Balázs Orbán <info@balazsorban.com>

* fix(provider): change provider id

Co-authored-by: Balázs Orbán <info@balazsorban.com>

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2021-04-28 19:10:05 +02:00
Balázs Orbán
7b82d6e985 fix(ts): typo in Adapter interface 2021-04-28 11:59:34 +02:00
4 changed files with 48 additions and 1 deletions

20
src/providers/42.js Normal file
View File

@@ -0,0 +1,20 @@
export default function FortyTwo(options) {
return {
id: '42-school',
name: '42 School',
type: 'oauth',
version: '2.0',
params: { grant_type: 'authorization_code' },
accessTokenUrl: 'https://api.intra.42.fr/oauth/token',
authorizationUrl:
'https://api.intra.42.fr/oauth/authorize?response_type=code',
profileUrl: 'https://api.intra.42.fr/v2/me',
profile: (profile) => ({
id: profile.id,
email: profile.email,
image: profile.image_url,
name: profile.usual_full_name,
}),
...options,
}
}

2
types/adapters.d.ts vendored
View File

@@ -42,7 +42,7 @@ export interface AdapterInstance<U = User, P = Profile, S = Session> {
accessTokenExpires?: null
): Promise<void>
/** @todo Implement */
unlinkAccont?(
unlinkAccount?(
userId: string,
providerId: string,
providerAccountId: string

View File

@@ -67,6 +67,7 @@ export type OAuthProviderType =
| "EVEOnline"
| "Facebook"
| "FACEIT"
| "FortyTwo"
| "Foursquare"
| "FusionAuth"
| "GitHub"

26
www/docs/providers/42.md Normal file
View File

@@ -0,0 +1,26 @@
---
id: 42-school
title: 42 School
---
## Documentation
https://api.intra.42.fr/apidoc/guides/web_application_flow
## Configuration
https://profile.intra.42.fr/oauth/applications/new
## Example
```js
import Providers from `next-auth/providers`
...
providers: [
Providers.FortyTwo({
clientId: process.env.FORTY_TWO_CLIENT_ID,
clientSecret: process.env.FORTY_TWO_CLIENT_SECRET
})
]
...
```