The following is a proper example of how to use curl to login to reddit:

curl -duser=USERNAME -dpasswd=PASSWORD -dapi_type=json https://ssl.reddit.com/api/login

By passing api_type=json you get meaningful json output rather than reddit-specific jquery based output.

{"json": {"errors": [],
          "data": {"modhash": "<REMOVED>",
                   "cookie": "<REMOVED>"}
         }
}

Note that reddit also properly uses the set-cookie header so that a proper http client / library will take advantage of the session for subsequent requests.

Your example did not work because you were not properly sending the form parameters. The example that you thought might have worked, in-fact did not. You were receiving a rate-limit response for failing to login too many times.

Answer from bboe on Stack Overflow
🌐
Reddit
reddit.com › r › reddit.com › wiki › api
r/reddit.com Wiki: Reddit API Access
November 28, 2023 - Select “I’m a Developer” and “I want to register to use the Reddit API.” Then, you can create credentials here.
🌐
Reddit
reddit.com › r/redditdev › how to login into reddit api?
r/redditdev on Reddit: How to login into reddit API?
October 5, 2018 -

We created application and generated oauth_token but we can't find the way how to use it to login into API to receive more information about our subredit posts (we need information if the post is approved or not for us to embed it on website). We also can't find it in the reddit api documentation. Any response is appreciate, thank you in advance.

🌐
Data365
data365.co › blog › how-to-get-reddit-api-key
How to Get Reddit API Key: Step-by-Step or Skip-the-Setup? | Data365.co
This gives you the Reddit API credentials the platform uses to identify and authorize your requests. So, log into your Reddit account and head to the app creation page. Scroll down and choose to create a new app by filling out the form: ... “script” – for personal use, backend tools, or automation that only need a single user’s access; “web app” – for apps with user-facing interfaces that use browser-based login ...
🌐
Reddit
reddit.com › dev › api
reddit.com: api documentation
Modhashes can be obtained via the /api/me.json call or in response data of listing endpoints. The preferred way to send a modhash is to include an X-Modhash custom HTTP header with your requests. Modhashes are not required when authenticated with OAuth. A fullname is a combination of a thing's type (e.g. Link) and its unique ID which forms a compact encoding of a globally unique ID on reddit.
🌐
Rymur
rymur.github.io › setup
Reddit API How-To - Setup
To get full access to the API we'll authenticate with our account. Using Node and the requests module, the code to authenticate will look like: var request = require("request"); var clientid = YOUR_CLIENT_ID; var secret = YOUR_CLIENT_SECRET; var options = { url: "https://www.reddit.com/api...
🌐
Reddit
reddit.com › r/redditdev › reddit api registration
r/redditdev on Reddit: Reddit API Registration
January 5, 2024 -

Hello, everyone.

I want to use the Reddit API just to experiment a bit with its data. I want to build an app for customer discovery and market research, and right now I haven't written a single line of code. I only want to see what I can do with the API and then I might build something.

However, the registration form is asking me for OAuth Client ID, an About URL and Redirect URI. How am I supposed to have these when I haven't even started building anything yet? I'm a senior year undergrad CS student and at this point I'm only looking to experiment a bit.

Can people please guide me how I can register for the API?

If this is not the right place to ask this question, please, let me know where I can post it.

Thanks.

🌐
Reddit
reddit.com › r/redditdev › how do you authenticate
r/redditdev on Reddit: How do you authenticate
November 19, 2020 -

How do you authenticate?

The API docs live here: https://www.reddit.com/dev/api It includes no information on how to use your client id and secret to authenticate.

This Github page) describes the procedure, but it hasn't been updated in 4 years, and when I attempt it, the token request call pulls up an HTML web page vice a JSON response.

There's a Python wrapper called PRAW, but it seems to be a bit messy, and it's also not clear if it's current. In general, Libs tend to be overkill for these sorts of API.

Is the Reddit API current and supported? How do you authenticate? Thank you.

Find elsewhere
🌐
Stateful
stateful.com › blog › reddit-oauth
Reddit OAuth: Let Users Sign into Your App With Reddit Login • Stateful
August 16, 2022 - All authenticated request to Reddit API makes use of the following URL: https://oauth.reddit.com.
🌐
Reddit
reddit.com › r/learnprogramming › api based "sign in with google" login
r/learnprogramming on Reddit: API based "Sign in with Google" login
April 2, 2024 -

Hello,

I use a website and I got the REST APIs that the website UI calls to display various details from the network tab. I do not want to use the website's UI as there are so many details which I am not interested in. Instead, I would like to build a CLI tool which fetches just the details I need.

The problem I face now is this.

The website that I use uses "Sign in with Google" option. When I click on that button, it takes me to the google sign in page and once I login, it returns a code (authorization code, I think - it has a slash as the second character, always) which is then passed to the website for authentication as a callback, I suppose. On receipt, the website returns a Bearer token. With this Bearer token, the UI calls the backend to retrieve the JSON's.

Now, I need this to be done fully without using any UI and it's associated redirection to google sign in, as I plan to develop a only a CLI tool. I would like to pass my email id and password to the tool and expect to get the code from Google's Oauth which I can then presumably use to get the token from the website.

Any help would be very helpful.

Thanks

🌐
AlpsCode
alpscode.com › blog › how-to-use-reddit-api
How to use Reddit API - AlpsCode
December 18, 2018 - Almost all public APIs requires registration. This is partly due to tracking the usage and preventing users to abuse available resources. Reddit’s registration is at this address after signing in: https://old.reddit.com/prefs/apps/
🌐
GitHub
gist.github.com › jpeckham › 6555a410c4f29731b6bd41957dc196ad
login to the reddit api and use a bearer token · GitHub
login to the reddit api and use a bearer token. GitHub Gist: instantly share code, notes, and snippets.
🌐
GitHub
github.com › filp › Reddit-API-Client › blob › master › Reddit.php
Reddit-API-Client/Reddit.php at master · filp/Reddit-API-Client
public function login($username, $password) { $request = new HttpRequest; $request->setUrl('http://www.reddit.com/api/login'); $request->setHttpMethod('POST'); $request->setPostVariable('user', $username); $request->setPostVariable('passwd', $password); ·
Author   filp
🌐
Reddit
reddit.com › r/redditdev › reddit as a login provider?
r/redditdev on Reddit: Reddit as a Login Provider?
December 15, 2016 -

I've been trying to implement a "Login with Reddit" button on a website - similar to Login with Google / Facebook / Twitter / GitHub / whatever.

I've got the OAuth thing working. First time a user tries it, they get the expected Reddit permission page for indefinite access to identity then they get sent to my callback and the world is a happy place until they log out.

However, next time they attempt to login using Reddit, they are once again presented with the authorization page, even though their Apps page on Reddit clearly lists the app as already authorized.

It should be immediately redirecting to the callback, but it isn't. If they Approve again, then it redirects.

I've been digging through google, asking other devs, and scanning this sub. I guess two years ago this was a "we're aware of it" thing? https://www.reddit.com/r/redditdev/comments/2nk8xq/why_must_users_of_my_website_reallow_access_to_my/

This isn't a matter of re-presenting a known token, as I do not have their token when they click on the login button. I've only implemented Google and FB so far but both of them work flawlessly after initial approval. I'd love to get Reddit working.

Is there anything I might be missing or is this simply not something I can do for my users?

🌐
Reddit
reddit.com › r/redditdev › api key credentials
r/redditdev on Reddit: API Key Credentials
May 1, 2022 -

Hey folks, this is baffling me - how do I create a new app/get API credentials?

When I go to /pref/apps I just get a "You are already logged in and will be redirected"

But when I get redirected I end up on the same screen.

Any insights? :-)

Thanks!

🌐
Reddit
reddit.com › r/redditdev › posting and login with reddit
r/redditdev on Reddit: Posting and Login with Reddit
April 13, 2024 -

To use a python script to post on behalf of a reddit account, I need this to set it up:

reddit = praw.Reddit(
client_id='YOUR_CLIENT_ID',
client_secret='YOUR_CLIENT_SECRET',
user_agent='YOUR_USER_AGENT',
username='YOUR_REDDIT_USERNAME',
password='YOUR_REDDIT_PASSWORD'
)

However, for the username and password, how can I make it so that the user can just Sign in with Reddit and authorize my web app? It's like using Login with Google via Firebase, but I'm not familiar with the reddit configuration process. Obviously the users will not send me their username and passwords. And some users login with google to reddit, so they don't have these credentials.

🌐
Reddit
reddit.com › r/redditdev › trying to get /api/login/ to work in javascript.
r/redditdev on Reddit: Trying to get /api/login/ to work in JavaScript.
March 28, 2012 -

Hi,

i'm running out of attempts... just got this "you are doing that too much. try again in 27 minutes." so I thought I would come here and ask.


This is the request I'm sending

URL:

http://www.reddit.com/api/login/

Headers:

User-Agent: "Reddit test app"

POST DATA:

user=USERNAME&passwd=PASSWORD&api_type=json


Putting the parameters in the URL instead... strangely works! I would like to avoid this though as it may not be safe to pass the password in the URL.

e.g. http://www.reddit.com/api/login/?user=USERNAME&passwd=PASSWORD&api_type=json


Another question... how do I access /api/v1/me/ ?

Tried passing modhash as a GET/POST parameter, and also by passing "uh" as a Header. None of them work.


Any ideas what I'm doing wrong? Thanks! :)

🌐
Public APIs
publicapis.io › home › social › reddit
Reddit API — Free Public API | Public APIs Directory
5 days ago - This will allow you to get an API key which is required for all API requests. Once you have a Reddit account, you can find your API key by navigating to the Apps & API section of your account settings.
🌐
Reddit
reddit.com › r/redditdev › reddit api request redirects to login page simple script
r/redditdev on Reddit: reddit API request redirects to login page simple script
June 17, 2022 -

I'm pulling my hair out, hoping someone can help. I've spent an embarrassing amount of time banging my head against the wall.

I have a simple script I'm working on, it authenticates and gets a bearer token. I am able to get json of the comments endpoint for example no problem.

If I try to go to the inbox, with bearer token, it redirects me to a login page and of course doesn't work. I could hack the login and password in to the request I guess, but isn't that what the token is for?

Any help at all is much appreciated.

EDIT: more information

Just to add https://oauth.reddit.com/api/v1/me works and returns json with my user info

Note that it says here: https://github.com/reddit-archive/reddit/wiki/OAuth2

that

"API requests with a bearer token should be made to https://oauth.reddit.com, NOT www.reddit.com."

Near as I can tell this is either bullshit or way out of date. I don't seem to be allowed to do ANYTHING at oauth except get th token and ask about myself.