Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(provider): add Salesforce provider #1027

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/providers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Mixer from './mixer'
import Netlify from './netlify'
import Okta from './okta'
import Reddit from './reddit'
import Salesforce from './salesforce'
import Slack from './slack'
import Spotify from './spotify'
import Strava from './strava'
Expand Down Expand Up @@ -59,6 +60,7 @@ export default {
Netlify,
Okta,
Reddit,
Salesforce,
Slack,
Spotify,
Strava,
Expand Down
21 changes: 21 additions & 0 deletions src/providers/salesforce.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export default (options) => {
return {
id: 'salesforce',
name: 'Salesforce',
type: 'oauth',
version: '2.0',
params: { display: 'page', grant_type: 'authorization_code' },
accessTokenUrl: 'https://login.salesforce.com/services/oauth2/token',
authorizationUrl: 'https://login.salesforce.com/services/oauth2/authorize?response_type=code',
profileUrl: 'https://login.salesforce.com/services/oauth2/userinfo',
state: false,
profile: (profile) => {
return {
...profile,
id: profile.user_id,
image: profile.picture
}
},
...options
}
}
22 changes: 22 additions & 0 deletions www/docs/providers/salesforce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: salesforce
title: Salesforce
---

## Documentation

https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm&type=5

## Example

```js
import Providers from `next-auth/providers`
...
providers: [
Providers.Salesforce({
clientId: process.env.SALESFORCE_CLIENT_ID,
clientSecret: process.env.SALESFORCE_CLIENT_SECRET,
})
}
...
```