Merge branch 'pr-1226' into devel

This commit is contained in:
Nick Martin
2013-07-23 22:50:32 -07:00
2 changed files with 8 additions and 1 deletions

View File

@@ -1066,6 +1066,11 @@ Template.api.loginWithExternalService = {
name: "requestOfflineToken",
type: "Boolean",
descr: "If true, asks the user for permission to act on their behalf when offline. This stores an additional offline token in the `services` field of the user document. Currently only supported with Google."
},
{
name: "forceApprovalPrompt",
type: "Boolean",
descr: "If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google."
}
]
};

View File

@@ -30,6 +30,7 @@ Google.requestCredential = function (options, credentialRequestCompleteCallback)
// https://developers.google.com/accounts/docs/OAuth2WebServer#formingtheurl
var accessType = options.requestOfflineToken ? 'offline' : 'online';
var approvalPrompt = options.forceApprovalPrompt ? 'force' : 'auto';
var loginUrl =
'https://accounts.google.com/o/oauth2/auth' +
@@ -38,7 +39,8 @@ Google.requestCredential = function (options, credentialRequestCompleteCallback)
'&scope=' + flatScope +
'&redirect_uri=' + Meteor.absoluteUrl('_oauth/google?close') +
'&state=' + credentialToken +
'&access_type=' + accessType;
'&access_type=' + accessType +
'&approval_prompt=' + approvalPrompt;
Oauth.initiateLogin(credentialToken, loginUrl, credentialRequestCompleteCallback);
};