How to get 'authorization_code_value'?
Created by: Drblack101
Currently, I can get 'authorization_code_value' then get access_token from Microsoft Azure if I manually copy/paste "authorize_url" into the browser. So request will send to Azure and it will redirect back to my callback with the "authorization_code" (I'm using params[:code] to get it].
But right now I have trouble making a call to "authorize link" to get the 'authorization_code_value' from the Ruby side. Here's my code:
client = OAuth2::Client.new(client_id, client_secret, :site => site_path, :authorize_url => auth_url, :token_urld => token_url, :scope => scope, :response_type => 'code', :grant_type => 'authorization_code')
authLink = client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/user/oauth2/callback', :response_mode => 'query')
Here, the 'authLink' will return successfully with the authorization link. But what's next? I can't use "get_token" because I need the "authorization_code_value". How can I use the 'authLink' to make another call to get code back?
token = client.auth_code.get_token('authorization_code_value', :redirect_uri => 'http://localhost:8080/user/oauth2/callback')