Reputation: 350
I have been using this as a resource: https://github.com/reddit/reddit/wiki/OAuth2-Quick-Start-Example
I am referencing the Curl Example to acquire a token.
Here is exactly what I am running in terminal:
curl -X POST -d 'grant_type=password&username=ollynov14@password=myrealpassword' --user 'jRje7BA55aycvA:myrealsecret' https://www.reddit.com/api/v1/access_token
(of course I have my actual secret and password in those fields above)
and I am getting the following error:
{"message": "Too Many Requests", "error": 429}
(I have been getting this error from the start so I don't think it actually has to do with how many times I've run this curl)
I just recently signed up for Reddit a couple hours ago in case that makes a difference...
Does anyone have an idea why I may not be getting the access token from the Reddit API? Much appreciated.
Upvotes: 4
Views: 2546
Reputation: 201513
It has to include "User agent". Please add an option "-A" to curl. And for your curl code, 'grant_type=password&username=ollynov14@password=myrealpassword' is wrong. Please change "@" to "&".
curl -X POST -A 'User agent' -d 'grant_type=password&username=ollynov14&password=myrealpassword' --user 'jRje7BA55aycvA:myrealsecret' https://www.reddit.com/api/v1/access_token
Using above command, following result can be got.
{"access_token": "#####", "token_type": "bearer", "expires_in": 3600, "scope": "*"}
Upvotes: 6