简体   繁体   English

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

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

Hello All implementing basic office 365 integration to contacts from a rails application. Hello All 实现基本的 office 365 集成到来自 rails 应用程序的联系人。 I have already connected with google using omniauth-google-oauth2 and google-api-client.我已经使用omniauth-google-oauth2 和google-api-client 与google 建立了联系。 I am following https://docs.microsoft.com/en-us/outlook/rest/ruby-tutorial for app setup and am using the strategy omniauth-office365 as I did previously.我正在关注https://docs.microsoft.com/en-us/outlook/rest/ruby-tutorial进行应用程序设置,并像以前一样使用omniauth-office365 策略。 It appears I have all setup right but when I authenticate I get the following error:看来我的所有设置都正确,但是当我进行身份验证时出现以下错误: 在此处输入图像描述

I have my settings in accordance to the docs, I dont know what I am missing..我根据文档进行了设置,我不知道我错过了什么..

The basic usage at this moment is just to authenticate which I have added the code below to omniauth.rb:此时的基本用法只是进行身份验证,我已将以下代码添加到omniauth.rb:

` `

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

I added a route to my routes.rb:我在我的 routes.rb 中添加了一条路线:

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

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

In my controller I added:在我的 controller 中,我添加了:

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

In a view I added a link to:在一个视图中,我添加了一个链接:

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

I did the above method with google and it worked fine, of course I added more code to get what I needed from the API but the upfront authentication was obtained.我用谷歌做了上述方法,效果很好,当然我添加了更多代码来从 API 获得我需要的东西,但获得了前期身份验证。 If I click the link I get the expected login/authenticate screens from office365, but it returns the permissions error shown in the image even though it is set to be able to access all accounts.如果我单击链接,我会从 office365 获得预期的登录/身份验证屏幕,但即使它设置为能够访问所有帐户,它也会返回图像中显示的权限错误。

Issue was with the gem strategy omniauth-office365.问题在于 gem 策略omniauth-office365。 I followed https://docs.microsoft.com/en-us/graph/tutorials/ruby?tutorial-step=3 and added that strategy and was able to authenticate..我遵循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