🌐
GitHub
github.com › reddit-archive › reddit › wiki › OAuth2
OAuth2 · reddit-archive/reddit Wiki · GitHub
You must supply your OAuth2 client's credentials via HTTP Basic Auth for this request. The "user" is the client_id, the "password" is the client_secret.
Author   reddit-archive
🌐
GitHub
github.com › KobeW50 › ReVanced-Documentation › blob › main › Reddit-Client-ID-Guide.md
ReVanced-Documentation/Reddit-Client-ID-Guide.md at main · KobeW50/ReVanced-Documentation
Mistake C: You accidentally added an extra space when entering the client ID in the ReVanced Manager. You must repatch, but you don't need to set up a new client ID. Mistake D: The redirect uri is set for the wrong app. Correct the issue here. Example: It is set to http://redditsync/auth even though the client ID will be used for an app other than Sync.
Author   KobeW50
🌐
Readthedocs
redditclient.readthedocs.io › en › latest › oauth
Oauth Setup - Reddit::Client Documentation
While Reddit::Client supports "web"-type apps, we don't have a tutorial for setting them up yet, so getting it to work is left as an exercise for the reader. The functions you will need, however, such as get_refresh_token are documented in Main Methods. Documentation for the entire "web"-type flow can be found at https://github.com/reddit-archive/reddit/wiki/OAuth2...
🌐
Better Auth
better-auth.com › docs › authentication › reddit
Reddit | Better Auth
export const auth = betterAuth({ socialProviders: { reddit: { clientId: process.env.REDDIT_CLIENT_ID as string, clientSecret: process.env.REDDIT_CLIENT_SECRET as string, duration: "permanent", scope: ["read", "submit"] // Add required scopes }, }, }) Common Reddit scopes include: identity: Access basic account information · read: Access posts and comments · submit: Submit posts and comments · subscribe: Manage subreddit subscriptions · history: Access voting history · For a complete list of available scopes, refer to the Reddit OAuth2 documentation. Edit on GitHub ·
🌐
Reddit
reddit.com › r/redditdev › should i keep my client id and secret.. well secret?
r/redditdev on Reddit: Should I keep my client ID and secret.. well secret?
January 25, 2021 -

I published a PRAW project on my github and I left those (+my user agent but not my refresh token) in the code in plain text. I didn't think it was an issue at the time, as they could just use my app instance to run the program, however later I thought that might be a security issue?

If someone were to take my client ID and secret, they shouldn't be able to authorize it with my reddit account or use my account permissions or do anything bad (the permissions are only identity and read anyway)

The worst thing I can think of is using my app instance and user agent to create a bot that breaks the TOS of the API and potentially get me in trouble.

🌐
Reddit
reddit.com › r/portainer › anyone have trouble with login via github oauth?
r/portainer on Reddit: Anyone have trouble with login via Github oauth?
November 12, 2024 -

as title, I try setting Github oauth in CE version using custom oauth/

I using this setting:

Client ID: Client ID
Client secret: Client secret
Authorization URL: https://github.com/login/oauth/authorize
Access token URL: https://github.com/login/oauth/access_token
Resource URL: https://api.github.com/user
Redirect URL: portainer's URL
Logout URL: blank
User identifier: email
Scopes: user:email
Auth Style: Auto

it can correct go to github login and authorize page but show Unable to login via OAuth at portainer.

after this got error I go to official website to get a 3-node-BE-Key to try build-in Github oauth.

I put the same Client ID and Client secret in it BE's setting and go github change Homepage and Callback URL to this BE's IP address (https://myipadd:9443) to test it and get same problem.

both with Automatic user provisioning so it should auto create user when using Oauth login.

so is it just portainer issue or github api dead? (github status says no error of api)

Find elsewhere
🌐
GitHub
github.com › rtheunissen › oauth2-reddit
GitHub - rtheunissen/oauth2-reddit: Reddit OAuth2 provider for league/oauth2-client
use Rudolf\OAuth2\Client\Provider\Reddit; $reddit = new Reddit([ 'clientId' => 'yourClientId', 'clientSecret' => 'yourClientSecret', 'redirectUri' => 'yourRedirectUri', 'userAgent' => 'platform:appid:version, (by /u/username)', 'scopes' => ['identity', 'read', ...], ]);
Starred by 12 users
Forked by 11 users
Languages   PHP
🌐
GitHub
github.com › atulmy › oauth
GitHub - atulmy/oauth: 🔗 OAuth 2.0 implementation for various providers in one place.
Update api/.env.local OAUTH_REDDIT_ID ... and click on Create button · Go to application's OAuth section https://discord.com/developers/applications/CLIENT_ID/oauth2 and for Redirects, create following two entries: http://localhos...
Starred by 469 users
Forked by 60 users
Languages   JavaScript 92.7% | CSS 5.3% | HTML 2.0%
🌐
Rymur
rymur.github.io › setup
Reddit API How-To - Setup
The “auth” option tells the request module to use HTTP basic authentication. For the Reddit API, the “username” is your client_id and the “password” is your client_secret. Finally, we set the content of our POST request with the “body” option.
🌐
Apidog
apidog.com › blog › set-up-github-oauth2
Setting up Github OAuth 2.0 (Client ID and Client Secret)
August 1, 2025 - Then find the Client ID, Client Secret and Callback URL at the bottom of the page. The client ID (Client ID), client secret (Client Secret) and configured callback address (Callback URL) will be obtained from Github's OAuth 2.0 service.
🌐
GitHub
docs.github.com › en › apps › oauth-apps › building-oauth-apps › authenticating-to-the-rest-api-with-an-oauth-app
Authenticating to the REST API with an OAuth app - GitHub Docs
get '/callback' do # get temporary GitHub code... session_code = request.env['rack.request.query_hash']['code'] # ... and POST it back to GitHub result = RestClient.post('https://github.com/login/oauth/access_token', {:client_id => CLIENT_ID, ...
🌐
Reddit
reddit.com › r › redditdev › comments › 1nfvos › reddit_oauth_beginner_question
r/redditdev - Reddit OAuth beginner question
August 5, 2010 -

Hi redditdev,

I have a small project to make a separate site to handle modmail in my sub because it is kinda hard to handle when you got ton of report using reddit default modmail.

I'm planning to use reddit OAuth so our redditor can just use their Reddit account to access the modmail site, I have no experience in OAuth, I read the tutorial from this link but I don't really understand the basic of token, authorize, etc.

https://github.com/reddit/reddit/wiki/OAuth2

Anyone have a good article for beginner to start? Site is written in C#(ASP), if anyone have a code example/API wrapper for C#, that would help me greatly.

Top answer
1 of 2
24

As of right now, you cannot retrieve a permanent access token. You have 2 options that come close.

The first is to request a "refresh" token when using the standard OAuth flow. That's what you're doing by sending "duration" as "permanent" in your code. The refresh token can be used to automatically retrieve new 1 hour access tokens without user intervention; the only manual steps are on the initial retrieval of the refresh token.

The second alternative, which applies only when writing a script for personal use, is to use the password grant type. The steps are described in more detail on reddit's "OAuth Quick Start" wiki page, but I'll summarize here:

  1. Create an OAuth client (under https://www.reddit.com/prefs/apps) with type = "script"
  2. Make a request to https://www.reddit.com/api/v1/access_token with POST parameters grant_type=password&username=<USERNAME>&password=<PASSWORD>. Send your client ID and secret as HTTP basic authentication. <USERNAME> must be registered as a developer of the OAuth 2 client ID you send.
2 of 2
17

A client_id and client_secret can be generated for a reddit account by going to https://www.reddit.com/prefs/apps and creating an app:


The part I have hidden is my client_id.

Then you can use a client like praw to access reddit e.g. with Python:

import praw
r = praw.Reddit(client_id='insert id here',
                client_secret='insert secret here',
                user_agent='insert user agent')
page = r.subreddit('aww')
top_posts = page.hot(limit=None)
for post in top_posts:
    print(post.title, post.ups)

You could use your current browser's user agent, which can be easily found by google searching "what is my user agent" (among other ways).

🌐
egghead.io
egghead.io › lessons › github-get-a-github-client-id-and-secret-for-an-oauth-application
Get a GitHub client ID and Secret for an OAuth Application
Get a client ID and Secret from GitHub by registering a new OAuth Application. You can register a new OAuth Application on Github here Make sure to kee...
🌐
Ranjith Nair
ranjithnair.github.io › 2018 › 02 › 27 › Reddit-Application-Oauth.html
How to use Reddit's Application Only OAuth · Ranjith Nair - Programming World
February 27, 2018 - Send a POST request to https://www.reddit.com/api/v1/access_token with the below parameters :- ... Please note that when you set Authorization header, you will be doing a Base64 encode of just the client ID and a blank password.
🌐
GitHub
github.com › reddit-archive › reddit › wiki › oauth2-quick-start-example
OAuth2 Quick Start Example · reddit-archive/reddit Wiki · GitHub
In [1]: import requests In [2]: import requests.auth In [3]: client_auth = requests.auth.HTTPBasicAuth('p-jcoLKBynTLew', 'gko_LXELoV07ZBNUXrvWZfzE3aI') In [4]: post_data = {"grant_type": "password", "username": "reddit_bot", "password": "snoo"} In [5]: headers = {"User-Agent": "ChangeMeClient/0.1 by YourUsername"} In [6]: response = requests.post("https://www.reddit.com/api/v1/access_token", auth=client_auth, data=post_data, headers=headers) In [7]: response.json() Out[7]: {u'access_token': u'fhTdafZI-0ClEzzYORfBSCR7x3M', u'expires_in': 3600, u'scope': u'*', u'token_type': u'bearer'} Use the token. Notice that for using the token, requests are made to https://oauth.reddit.com.
Author   reddit-archive
🌐
GitHub
github.com › KirkBushman › Android-Reddit-OAuth2
GitHub - KirkBushman/Android-Reddit-OAuth2: Reddit OAuth2 authentication client for android
val authClient = RedditAuth.Builder() // specify the credentials you can find on your reddit app console // for script / web apps you will be given a client id and a client secret .setCredentials(creds.username, creds.password, creds.scriptClientId, creds.scriptClientSecret) // the api endpoints scopes this client will need .setScopes(creds.scopes.toTypedArray()) // to manage tokens info in memory .setStorageManager(SharedPrefsStorageManager(this)) // if you set this flag to 'true' it will add to the OkHttp Client a listener to log the // Request and Response object, to make it easy to debug.
Starred by 10 users
Forked by 3 users
Languages   Kotlin 97.7% | HTML 2.3%