I'm trying to figure out how to get the refresh token from an office365 user with omniauth.
In my devise.rb
file I have tried two different ways but to no avail:
config.omniauth :microsoft_office365, ENV['OFFICE365_APP_ID'], ENV['OFFICE365_SECRET'],
access_type: 'offline',
scope: 'https://outlook.office.com/calendars.read'
config.omniauth :microsoft_office365, ENV['OFFICE365_APP_ID'], ENV['OFFICE365_SECRET'],
scope: 'https://outlook.office.com/calendars.read, offline_access'
Am I doing something wrong here?
It turns out the offline_access scope needn't be defined in devise.rb
. All you have to do is add the scope in the Microsoft Application Registration Portal.
For me, the microsoft_office365 config line in devise.rb
now looks like this:
config.omniauth :microsoft_office365, ENV['OFFICE365_APP_ID'], ENV['OFFICE365_SECRET'],
scope: 'https://outlook.office.com/calendars.read'