Skip to content

Commit

Permalink
feat(provider): add Salesforce provider (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmahalwy authored and balazsorban44 committed Feb 1, 2021
1 parent a15bdc1 commit 2f3ed75
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
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,
})
}
...
```

0 comments on commit 2f3ed75

Please sign in to comment.