mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'pr-1226' into devel
This commit is contained in:
@@ -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."
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user