Hello,
I am trying to debug a really big pain of an End Point, it's the AWS Cognito Token End Point, so I'm wondering how I might print out the raw request that HTTP puts together to send out.
Any help would be greatly appreciated. I already burned a few days trying to use Net::HTTP.
I can get this thing to work over curl, so I know it's in how I'm sending.
Here's the working CURL command:
curl -d "grant_type=authorization_code&client_id=<my_client_id>&code=<code_given_by_cognito>&redirect_uri=<my_redirect_url>" -H "Content-Type: application/x-www-form-urlencoded" -X POST https://<my_domain>.
auth.us-west-2.amazoncognito.com/oauth2/token
Here's my Ruby code:
ctx = OpenSSL::SSL::SSLContext.new
ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
path = "https://<my_domain>.auth.us-west-2.amazoncognito.com/oauth2/token"
args = "grant_type=authorization_code&client_id=<my_client_id>&code=<code_given_by_cognito>&redirect_uri=<my_redirect_url>"
response = HTTP.headers(:content_type => "application/x-www-form-urlencoded").post(path, :body => args, :ssl_context => ctx)
Thanks!
Chris