Skip to content

Commit

Permalink
Merge pull request joshbirk#20 from philwilks/patch-1
Browse files Browse the repository at this point in the history
Update Readme to explain new parameters
  • Loading branch information
joshbirk authored Jan 22, 2020
2 parents 2d87c0d + 98ae766 commit 120ff3b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ passport.use(new ForceDotComStrategy({
app.get('/auth/forcedotcom', passport.authenticate('forcedotcom'), {
display: "page", // valid values are: "page", "popup", "touch", "mobile"
prompt: "", // valid values are: "login", "consent", or "login consent"
login_hint: ""
login_hint: "", // optional: the user's SalesForce email address or username
state: "" // optional: an aribrary URL encoded string that will get passed back to you
});
// this should match the callbackURL parameter above:
app.get('/auth/forcedotcom/callback',
Expand All @@ -60,6 +61,10 @@ app.get('/auth/forcedotcom/callback',

And as usual with passport, you can update the user serialization/de-serialization.

The `login_hint` parameter may be used by SalesForce to pre-populate the username field on the login form. This don't seem to be very reliable though. See the [SalesForce OAuth documentation](https://help.salesforce.com/articleView?id=remoteaccess_oauth_web_server_flow.htm&type=0) for more details.

The `state` parameter is useful if you need to maintain information about the user between initiating the login with SalesForce and the user being redirected back to your application. This avoids the need to rely on a cookie to maintain any state information. For example, you could use this to track the page that the user was trying to access before they started the login process. If you pass a `state` string then it should be [URL encoded](https://en.wikipedia.org/wiki/Percent-encoding).

### Creating a Connected App

In order to use this Strategy, you'll need to have a [Connected
Expand Down

0 comments on commit 120ff3b

Please sign in to comment.