/omniauth-office365

OmniAuth OAuth2 strategy for the Office365 v2.0 REST API

Primary LanguageRubyMIT LicenseMIT

OmniAuth Office365

Gem Version Build Status Code Climate

Gem to authenticate applications to the Office365 v2.0 REST API via OAuth2.

Note An unmaintained (at least as of this writing) omniauth-office365 gem exists at https://github.com/simi/omniauth-office365. However, it's built on an older, deprecated version of the API.

Setup

Note Depending on the which scopes you choose, a successful response may not contain an access_token. In that cases, an error will be raised in the oauth2 gem. There's a PR that should address this: oauth-xx/oauth2#243.

Standard setup:

  # Add to your initializers/omniauth.rb

  use OmniAuth::Builder do
    provider :office365, ENV['OFFICE365_APP_ID'], ENV['OFFICE365_APP_SECRET'], :scope => 'https://outlook.office.com/mail.read'
  end

Setup with Devise:

  # Add to your devise.rb

  config.omniauth :office365, ENV['OFFICE365_APP_ID'], ENV['OFFICE365_APP_SECRET'], :scope => 'https://outlook.office.com/mail.read'