【问题标题】:Is there a way to authenticate both Gmail Oauth and Google Contacts API AuthSub at one time?有没有办法同时对 Gmail Oauth 和 Google Contacts API AuthSub 进行身份验证?
【发布时间】:2010-08-19 01:44:50
【问题描述】:

我可以使用 oauth 访问用户的 gmail 帐户,并且我可以通过 google 联系人 API(使用 AuthSub)访问用户联系人及其联系人组。对于我的应用程序,我需要这两个,有没有一种方法可以同时对两者进行身份验证,这样我就不需要用户通过两个单独的身份验证会话?

或者有没有一种方法可以让我单独使用 Gmail oAuth 访问用户的联系人组?

【问题讨论】:

    标签: api oauth gmail contacts


    【解决方案1】:

    我认为这是不可能的,因为 authsub 似乎是一个不同的过程,需要单独处理。但是,我建议通过指定请求的“范围”参数来同时使用 oauth 进行身份验证,以包括联系人 url 和 gmail 之一。

    【讨论】:

      【解决方案2】:

      我有一个类似的问题 - 很抱歉提出一个旧线程。

      @benjaminlotan - 你说“但是,我建议通过指定请求的“范围”参数来同时使用 oauth 进行身份验证,以包括联系人 url 和 gmail 之一。”

      具体是怎么做到的?

      当前代码是:

      // Prepare the OAuth extension
      string scope = GoogleConsumer.GetScopeUri(GoogleConsumer.Applications.Contacts);
      Global.GoogleWebConsumer.AttachAuthorizationRequest(authReq, scope);
      

      您只能指定一个范围,我似乎找不到连接 URI 的方法,以便我也可以将 GoogleConsumer.Applications.Gmail 添加到范围中。

      【讨论】:

      • 抱歉,想通了,它们只是被一个空格连接起来。
      【解决方案3】:

      这是一个快速的 python 示例(您没有编写您使用的语言),希望对您有所帮助!

      def GetAuthSubUrl(next):
          oauthURL = urlparse(next)
          oauthURL = oauthURL.scheme + '://' + oauthURL.netloc + oauthURL.path + "oauth"
          scope = ['https://picasaweb.google.com/data/', 'https://www.google.com/m8/feeds/']
          secure = False
          session = True
          gd_client = gdata.photos.service.PhotosService()
          return gd_client.GenerateAuthSubURL(oauthURL, scope, secure, session);
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2011-10-21
        • 2013-05-23
        • 1970-01-01
        • 1970-01-01
        • 2012-11-27
        • 2018-06-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多