繁体   English   中英

来自 Outlook rest API 的 omniauth-office365 gem 权限错误

[英]omniauth-office365 gem permission error from Outlook rest API

Hello All 实现基本的 office 365 集成到来自 rails 应用程序的联系人。 我已经使用omniauth-google-oauth2 和google-api-client 与google 建立了联系。 我正在关注https://docs.microsoft.com/en-us/outlook/rest/ruby-tutorial进行应用程序设置,并像以前一样使用omniauth-office365 策略。 看来我的所有设置都正确,但是当我进行身份验证时出现以下错误: 在此处输入图像描述

我根据文档进行了设置,我不知道我错过了什么..

此时的基本用法只是进行身份验证,我已将以下代码添加到omniauth.rb:

`

Rails.application.config.middleware.use OmniAuth::Builder do
     provider :office365, '$myid', '$mykey',
           {:scope => 'mail.read, User.read, profile,openid'}
end

我在我的 routes.rb 中添加了一条路线:

  get 'auth/:provider/callback', to: 'contacts#contact_integrations'

  get 'auth/failure', to: redirect('/')

在我的 controller 中,我添加了:

  def contact_integrations
    access_token = request.env["omniauth.auth"]
  end

在一个视图中,我添加了一个链接:

<%= link_to 'Outlook', "/auth/office365" %>

我用谷歌做了上述方法,效果很好,当然我添加了更多代码来从 API 获得我需要的东西,但获得了前期身份验证。 如果我单击链接,我会从 office365 获得预期的登录/身份验证屏幕,但即使它设置为能够访问所有帐户,它也会返回图像中显示的权限错误。

问题在于 gem 策略omniauth-office365。 我遵循https://docs.microsoft.com/en-us/graph/tutorials/ruby?tutorial-step=3并添加了该策略并能够进行身份验证..

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM