I'm trying to get a token to access Reddits API. I can get one perfectly 
fine with

curl -X POST -d 'grant_type=password&username=[MYNAME]&password=[MYPASS]' 
--user 
'CLIENTID:CLIENTSECRET' https://www.reddit.com/api/v1/access_token

This gives me what I need. I kind of want to retrieve it directly from 
julia (maybe to be used in a Reddit.jl-package), but I can't get it to 
work. I would have guessed that the following post-request was the same, 
but it seems not to be the case.

enc = bytestring(encode(Base64, "CLIENTID:CLIENTSECRET"))
post(URI("https://www.reddit.com/api/v1/access_token";), 
"grant_type=password&username=[MYNAME]&password=[MYPASS]"; headers = 
Dict("Authorization" => "Basic $enc", "User-Agent" => UserAgent))
% UserAgent is a string here

Do you have any idea why these POST requests are not the same ? They can't 
be, as the Julia post call gives me

"{\"error\": \"unsupported_grant_type\"}"

Is there maybe a way for me to see the POST request produced by post()?

Thanks for the help in advance.
Patrick

Reply via email to