admin管理员组文章数量:1415484
I'm trying to do Gmail Oauth.
When I call this function with immediate:true, still it's showing the popup window while authorizing.
Please let me know any mistake is there or not, also any alternative method.
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, callbackAuthResult);
Here's my Code:
function signin(getAuthStatus) {
gapi.auth.authorize({
'client_id': 'myID',
scope: 'email', immediate: true
},getAuthStatus);
}
function getAuthStatus() {
gapi.client.Myendpoint.MyEndpointMethod().execute(function (resp) {
console.log(resp);
}
I'm trying to do Gmail Oauth.
When I call this function with immediate:true, still it's showing the popup window while authorizing.
Please let me know any mistake is there or not, also any alternative method.
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, callbackAuthResult);
Here's my Code:
function signin(getAuthStatus) {
gapi.auth.authorize({
'client_id': 'myID',
scope: 'email', immediate: true
},getAuthStatus);
}
function getAuthStatus() {
gapi.client.Myendpoint.MyEndpointMethod().execute(function (resp) {
console.log(resp);
}
Share
Improve this question
asked Oct 27, 2015 at 6:49
Amaresh C.Amaresh C.
5995 silver badges17 bronze badges
1 Answer
Reset to default 6First of all, We have to understand how oauth process works,
In Google OAuth,
If immediate value is false, then browser will open up a popup, where people have to allow your application to get their details from Google.
If immediate value is true, then it'll be automatically authorized without any popup, where people don't have to allow the application.
Keep immediate value as false, while you are asking user to login to your application for the first time, then browser will open up popup and user will allow your application to get details. From next time onwards, wherever you are using OAuth to make authenticated calls in your application, put immediate value as true, because user already allowed your application, so you'll get user info directly without asking him for permissions again and again.
本文标签: javascriptgapiauthauthorize with immediate true is not workingStack Overflow
版权声明:本文标题:javascript - gapi.auth.authorize with immediate: true is not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745231201a2648831.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论