javascript – Google API多个范围

前端之家收集整理的这篇文章主要介绍了javascript – Google API多个范围前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在Google API JavaScript中使用多个范围.
我想要做的是让用户Email&名称.

我可以从范围获得的名称https://www.googleapis.com/auth/plus.me

我可以从范围获得电子邮件https://www.googleapis.com/auth/userinfo.email

但是如何在同一个应用程序中使用它们呢?

我的代码是:

scopes = 'https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.email';

    gapi.signin.render('StartGoogleBtn',{
      'callback': 'onSignInCallback','clientid': clientId,'cookiepolicy': 'single_host_origin','scope': scopes
    });

应该是什么范围?谢谢 :)

解决方法

只是猜测,但尝试用围绕它的双引号分隔的空格.这就是OAuth 2所要求的,当我为客户端编写代码时,我会自动正确地处理该场景.我认为它只是通过命令传递.这对我有用.
scopes = "https://www.googleapis.com/auth/userinfo.email  https://www.googleapis.com/auth/plus.me"
原文链接:https://www.f2er.com/js/149969.html

猜你在找的JavaScript相关文章