Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[providers]: Add FusionAuth provider (#599)
* Add FusionAuth provider * Fix issue with FusionAuth docs.
- Loading branch information
1 parent
43d8e3b
commit 2f3291e
Showing
5 changed files
with
77 additions
and
1 deletion.
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,27 @@ | ||
export default (options) => { | ||
let authorizationUrl = `https://${options.domain}/oauth2/authorize?response_type=code` | ||
if (options.tenantId) { | ||
authorizationUrl += `&tenantId=${options.tenantId}` | ||
} | ||
|
||
return { | ||
id: 'fusionauth', | ||
name: 'FusionAuth', | ||
type: 'oauth', | ||
version: '2.0', | ||
scope: 'openid', | ||
params: { grant_type: 'authorization_code' }, | ||
accessTokenUrl: `https://${options.domain}/oauth2/token`, | ||
authorizationUrl, | ||
profileUrl: `https://${options.domain}/oauth2/userinfo`, | ||
profile: (profile) => { | ||
return { | ||
id: profile.sub, | ||
name: profile.name, | ||
email: profile.email, | ||
image: profile.picture | ||
} | ||
}, | ||
...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
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,46 @@ | ||
--- | ||
id: fusionauth | ||
title: FusionAuth | ||
--- | ||
|
||
## Documentation | ||
|
||
https://fusionauth.io/docs/v1/tech/oauth/ | ||
|
||
## Example | ||
|
||
```js | ||
import Providers from `next-auth/providers` | ||
... | ||
providers: [ | ||
Providers.FusionAuth({ | ||
id: "fusionauth", | ||
name: "FusionAuth", | ||
domain: process.env.FUSIONAUTH_DOMAIN, | ||
clientId: process.env.FUSIONAUTH_CLIENT_ID, | ||
clientSecret: process.env.FUSIONAUTH_SECRET, | ||
tenantId: process.env.FUSIONAUTH_TENANT_ID // Only required if you're using multi-tenancy | ||
}), | ||
} | ||
... | ||
``` | ||
|
||
:::warning | ||
If you're using multi-tenancy, you need to pass in the `tenantId` option to apply the proper theme. | ||
::: | ||
|
||
## Instructions | ||
|
||
### Configuration | ||
|
||
:::tip | ||
An application can be created at https://your-fusionauth-server-url/admin/application. | ||
|
||
For more information, follow the [FusionAuth 5-minute setup guide](https://fusionauth.io/docs/v1/tech/5-minute-setup-guide). | ||
::: | ||
|
||
In the OAuth settings for your application, configure the following. | ||
* Redirect URL | ||
- https://localhost:3000/api/auth/callback/fusionauth | ||
* Enabled grants | ||
- Make sure *Authorization Code* is enabled. |
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
2f3291e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: