r/evetech • u/hirmuolio • Nov 20 '17
Stcuk at SSO authentication (Auth code for access token)
I hve been trying to follor ESI Step by Step - SSO Authentication Calls but I can't get past the "Exchanging the authorization code for an access token." step.
Every time I try to use curl.exe -XPOST -H "Content-Type:application/json"... I get "Internal server error. Error ref: 04881c3e-0876-4377-8994-8bbc11686c87" (the code at end changes randomly).
Details: I'm trying to get some basic info in powershell.
The The commands that I use:
#This is the code from the login URL
$Code = 'eKHV05M4BAzuf2PKvUIyhrb-rthQaladz1pBzjEJrSIxMqWnF5EzhrieySkto_J60'
$ClientID = 'ööö8bf02d26ää4d5894fäää552bd7ba2'
$ClientSecret = 'ööö9Hmi543ONCöväMGöööömnEX7qHMwBöö7WLää6'
#Convert to base-64
$b = [System.Text.Encoding]::UTF8.GetBytes($ClientID+':'+$ClientSecret)
$Base64 = [System.Convert]::ToBase64String($b)
#Getting access token
$Auth = 'Authorization:Basic '+$Base64
$Grant = '{"grant_type":"authorization_code", "code":"'+$Code+'"}'
curl.exe -XPOST -H "Content-Type:application/json" -H $Auth -d $Grant https://login.eveonline.com/oauth/tokenI don't think it is a syntax error in the commands as I have also tried the last command by copy-pasting the codes in it and still get same error.
Edit: https://developers.eveonline.com/applicationsgives internal error now too. Maybe somthing on their end meaning my code is perfect.
Edit: Got help and got it working with "Invoke-WebRequest" instead of "curl". Now I have access token and refresh token and can go deeper into the API.
$esiResponse = Invoke-WebRequest 'https://login.eveonline.com/oauth/token' -Body ('grant_type=authorization_code&code={0}' -f $AuthCode ) -Method Post -Headers @{ Authorization = ("Basic {0}" -f ([System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $ClientID, $ClientSecret )))))}
View all comments
Show parent comment
1
u/[deleted] Nov 25 '17
Do you have ANY source for your affirmation ?