Skip to content

Commit

Permalink
Merge pull request #127 from ozkatz/master
Browse files Browse the repository at this point in the history
add option to force user re-approval of app in the google2 strategy
  • Loading branch information
ciaranj committed Apr 29, 2013
2 parents 94727eb + ae5c3ab commit 9b7c064
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/auth.strategies/google2.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports= function(options, server) {
my._redirectUri= options.callback;
my.scope= options.scope || "https://www.googleapis.com/auth/userinfo.profile";
my.accessType = options.accessType || null;
my.forceApproval = options.forceApproval || false;

// Ensure we have the correct scopes to match what the consumer really wants.
if( options.requestEmailPermission === true && my.scope.indexOf("auth/userinfo.email") == -1 ) {
Expand Down Expand Up @@ -104,6 +105,9 @@ module.exports= function(options, server) {
// support offline access as per https://developers.google.com/accounts/docs/OAuth2WebServer#offline
if(my.accessType !== null)
urlParams.access_type = my.accessType; // access_type=offline
// force displaying the approval prompt to the user. In such a case, a refresh_token will be regenerated.
if (my.forceApproval)
urlParams.approval_prompt = 'force';
var redirectUrl= my._oAuth.getAuthorizeUrl(urlParams);
self.redirect(response, redirectUrl, callback);
}
Expand Down

0 comments on commit 9b7c064

Please sign in to comment.