Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
ADD authorize params support
Browse files Browse the repository at this point in the history
  • Loading branch information
palmerabollo committed Oct 21, 2015
1 parent 327b115 commit bedab52
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -61,6 +61,7 @@ are running your own TAccounts service:
* authorizationURL
* tokenURL
* profileURL
* authorizeParams: supports prompt='login'

## License

Expand Down
6 changes: 6 additions & 0 deletions lib/index.js
Expand Up @@ -81,8 +81,14 @@ function TAccountsStrategy(options, verify) {

this.userProfile = getUserProfile;

this.authorizationParams = getAuthorizationParams;

///////////////////

function getAuthorizationParams() {
return options.authorizeParams ? options.authorizeParams : {};
}

function getUserProfile(accessToken, callback) {
var requestOptions = {
url: options.profileURL,
Expand Down
18 changes: 18 additions & 0 deletions test/unit/taccounts-test.js
Expand Up @@ -83,4 +83,22 @@ describe('TAccounts user profile', function() {
done();
});
});

it('should use authorization params', function(done) {
var options = {
clientID: '2b8672be-5c80-ac91-96da-f4b922105431',
clientSecret: 'f5d689ac-fc2c-4e32-ac8a-321212ca1a8d',
authorizeParams:{
prompt: 'login'
}
};
function verify() {};

var strategy = new TAccountsStrategy(options, verify);

var params = strategy.authorizationParams();
expect(params).to.be.deep.equal(options.authorizeParams);

done();
});
});

0 comments on commit bedab52

Please sign in to comment.