app/controllers/pages_controller.rb
# If the user had to sign-in, the browser will redirect to this callback
# with an authorization code attached
# Then the app has to make a POST request to get tokens that it can use
# for authenticated requests to resources in graph.microsoft.com
# rubocop:disable Metrics/AbcSize
If the user had to sign-in, the browser will redirect to this callback
with an authorization code attached
Then the app has to make a POST request to get tokens that it can use
for authenticated requests to resources in graph.microsoft.com
rubocop:disable Metrics/AbcSize
If the user had to sign - in the browser will redirect to this callback with an authorization code attached Then the app has to make a POST request to get tokens that it can use for authenticated requests to resources in graph . microsoft . com rubocop : disable Metrics / AbcSize
def callback
    code = params[:code]
    @name = auth_hash.info.name
    @email = auth_hash.info.email
    result = acquire_access_token(code, ENV['REPLY_URL'])
    logger.info "Code: #{result}"
    session[:access_token] = result.access_token
    session[:name] = @name
    session[:email] = @email
    logger.info "Code: #{code}"
    logger.info "Name: #{@name}"
    logger.info "Email: #{@email}"
    logger.info "[callback] - Access token: #{session[:access_token]}"
  end
def callback code = params [ :code ] @name = auth_hash . info . name @email = auth_hash . info . email result = acquire_access_token ( code , ENV [ 'REPLY_URL' ] ) logger . info "Code: #{result}" session [ :access_token ] = result . access_token session [ :name ] = @name session [ :email ] = @email logger . info "Code: #{code}" logger . info "Name: #{@name}" logger . info "Email: #{@email}" logger . info "[callback] - Access token: #{session[:access_token]}" end
If the user had to sign-in, the browser will redirect to this callback
with an authorization code attached
Then the app has to make a POST request to get tokens that it can use
for authenticated requests to resources in graph.microsoft.com
rubocop:disable Metrics/AbcSize
If the user had to sign - in the browser will redirect to this callback with an authorization code attached Then the app has to make a POST request to get tokens that it can use for authenticated requests to resources in graph . microsoft . com rubocop : disable Metrics / AbcSize
# Authentication redirects here # params = {'box1' => '', # 'button1' => 'Submit' # } # x = Net::HTTP.post_form(URI.parse('https://login.microsoftonline.com'), params) # puts x.body # Used in the template # Request an access token # Associate token/user values to the session # Debug logging