【问题标题】:Outlook REST API expirationOutlook REST API 到期
【发布时间】:2016-10-17 07:20:46
【问题描述】:

我按照这个官方教程在我的 Rails 应用程序上实现了 Outlook REST api:https://dev.outlook.com/restapi/tutorial/ruby 顺便说一句,它需要更新。 Outlook 现在需要更多权限 ('profile') 才能在身份验证控制器中获取用户的电子邮件:

SCOPES = [ 'openid', 'profile', 'https://outlook.office.com/mail.read' ]

无论如何,我在验证后存储了电子邮件和令牌,但该令牌的寿命很短。我需要一种为用户永久存储身份验证的方法。 当我按照建议运行并希望收到电子邮件时,回复是:

...
  response_headers: !ruby/hash-with-ivars:Faraday::Utils::Headers
    elements:
      content-length: '0'
      server: Microsoft-IIS/8.5
      set-cookie: exchangecookie=afaeef5a8a6747aab24dad1ddb97a8fb; expires=Fri, 16-Jun-2017
        00:07:54 GMT; path=/; HttpOnly
      www-authenticate: Bearer client_id="00000002-0000-0ff1-ce00-000000000000", trusted_issuers="00000001-0000-0000-c000-000000000000@*",
        token_types="app_asserted_user_v1 service_asserted_app_v1", authorization_uri="https://login.windows.net/common/oauth2/authorize",
        error="invalid_token",Basic Realm="",Basic Realm=""
      request-id: c59488ab-62b5-4a9f-a3f5-43bda739c9ab
      x-calculatedbetarget: BLUPR07MB260.namprd07.prod.outlook.com
      x-backendhttpstatus: '401'
      x-ms-diagnostics: '2000010;reason="ErrorCode: ''PP_E_RPS_REASON_TIMEWINDOW_EXPIRED''.
        Message: ''Failed the Validate call, reason: Time window expired.%0d%0a''";error_category="invalid_msa_ticket"'
      x-diaginfo: BLUPR07MB260
      x-beserver: BLUPR07MB260
      x-powered-by: ASP.NET
      x-feserver: BN3PR16CA0057
      x-msedge-ref: 'Ref A: 3E2E02429DE244F7A738A7BE6CF9E06B Ref B: CAA6321D024D5B725BA8FFE7DAC85411
        Ref C: Wed Jun 15 17:07:54 2016 PST'
      date: Thu, 16 Jun 2016 00:07:54 GMT
      connection: close
    ivars:
      :@names:
        content-length: content-length
        server: server
        set-cookie: set-cookie
        www-authenticate: www-authenticate
        request-id: request-id
        x-calculatedbetarget: x-calculatedbetarget
        x-backendhttpstatus: x-backendhttpstatus
        x-ms-diagnostics: x-ms-diagnostics
        x-diaginfo: x-diaginfo
        x-beserver: x-beserver
        x-powered-by: x-powered-by
        x-feserver: x-feserver
        x-msedge-ref: x-msedge-ref
        date: date
        connection: connection
  status: 401

如何调整此代码以存储永久令牌?

【问题讨论】:

    标签: ruby-on-rails api outlook


    【解决方案1】:

    OKoffline_access”添加到SCOPES = [ 'openid', 'profile', 'offline_access', 'https://outlook.office.com/mail.read' ]

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多