Add Reddit OAuth authentication for API access #281
Labels
No labels
blocked
duplicate
needs
approval
needs
criteria
needs
estimate
needs
tests
question
type
admin
type
alert
type
bug
type
change
type
defect
type
dependencies
type
epic
type
idea
type
incident
type
investigation
type
spike
type
story
won't fix
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
RabbitLabs/random-bunny#281
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Unauthenticated Reddit
.json/ listing access is blocked as of late May 2026 (HTTP 403). That breaks the current fetch path inRedditHelper, so bothyarn startand the packaged CLI fail withFailed to fetch result from Reddit.This blocks / supersedes the remaining work on #277 (comment). Cookie bootstrapping via
old.reddit.comand swappinggot-cjsfor nativefetchare no longer enough.Confirmed locally:
https://old.reddit.com/...andhttps://www.reddit.com/.../*.jsonreturn 403https://oauth.reddit.comGoal
Add a first-class Reddit authentication flow so random-bunny can keep reading public subreddit listings (hot/new/top) without scraping.
Recommended approach
Application-only OAuth (
client_credentials) with a user-owned script/web app.Why this fits random-bunny:
client_secretand can usegrant_type=client_credentialsToken flow
http://localhost:8080Response shape should still match today's listing JSON (
data.children[].data), so gallery parsing can stay mostly unchanged.Alternatives considered
client_credentialsinstalled_clientclient_id; shared maintainer client_id risks rate-limit/abuse; needs stabledevice_idProposed product design
Library API
Require credentials (breaking change, or optional object with clear error if missing):
CLI
Credential sources (priority order):
--client-id/--client-secretREDDIT_CLIENT_ID,REDDIT_CLIENT_SECRET, optionalREDDIT_USER_AGENT~/.config/random-bunny/config.json)Suggested UX helpers:
random-bunny auth/ setup docs explaining how to create a Reddit appexpires_inSecurity rules
Implementation outline
RedditAuthHelper(or extendRedditHelper) to request/cache bearer tokensold.reddit.com/...jsontooauth.reddit.com/r/{sub}/{sort}readme.md,docs/cli.md) with Reddit app setup stepspkgbinaryAcceptance criteria
yarn startreturns a random image result againGalleryHelperOpen questions
References
.jsondeprecation / scraper policy