-1

Hello All implementing basic office 365 integration to contacts from a rails application. I have already connected with google using omniauth-google-oauth2 and google-api-client. I am following https://learn.microsoft.com/en-us/outlook/rest/ruby-tutorial for app setup and am using the strategy omniauth-office365 as I did previously. It appears I have all setup right but when I authenticate I get the following error : enter image description here

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:

`

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:

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

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

In my controller I added :

  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. 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.

Louie
  • 29
  • 3
  • Office 365 was down world wide. If your setup was previously working it could be related to that. https://www.nzherald.co.nz/business/news/article.cfm?c_id=3&objectid=12286870 – aconnelly Nov 21 '19 at 03:00
  • Please see "[ask]" and the linked pages and "[mcve](https://stackoverflow.com/help/minimal-reproducible-example)". – the Tin Man Nov 21 '19 at 05:24

1 Answers1

0

Issue was with the gem strategy omniauth-office365. I followed https://learn.microsoft.com/en-us/graph/tutorials/ruby?tutorial-step=3 and added that strategy and was able to authenticate..

Louie
  • 29
  • 3