Skip to content

Commit

Permalink
feat: save token after get user info
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Tian committed Nov 12, 2019
1 parent 209a6a7 commit adaecde
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion lib/strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ function CitiStrategy(options, verify) {
options.saveToken
);
this._state = options.state;
this._scope = options.scope || "pay_with_points accounts_details_transactions customers_profiles payees personal_domestic_transfers internal_domestic_transfers external_domestic_transfers bill_payments cards onboarding reference_data";
this._scope =
options.scope ||
"pay_with_points accounts_details_transactions customers_profiles payees personal_domestic_transfers internal_domestic_transfers external_domestic_transfers bill_payments cards onboarding reference_data";
this._countryCode = options.countryCode || "sg";
this._passReqToCallback = options.passReqToCallback;
}
Expand Down Expand Up @@ -131,6 +133,15 @@ CitiStrategy.prototype.authenticate = async function(req, options) {
params.access_token
);

try {
this.saveToken(
profile.emails ? profile.emails[0].emailAddress : "",
params
);
} catch (ex) {
this.logger.error("error = ", ex);
}

debug("fetch userinfo -> \n %s", JSON.stringify(profile, null, " "));

// merge params
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"semantic-release": "^15.13.30"
},
"dependencies": {
"citi-oauth": "1.1.0",
"citi-oauth": "1.2.0",
"debug": "latest",
"passport": "^0.3.0",
"passport-strategy": "^1.0.0",
Expand Down

0 comments on commit adaecde

Please sign in to comment.