Skip to content

Reddit

OAuth 2.0 with duration=permanent for non-expiring refresh tokens. Token exchange uses Basic auth (clientId:clientSecret) with a mandatory User-Agent header.

Authentication at a glance

FieldValue
Auth modelOAuth 2.0
Required ENVREDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_USER_AGENT
Callback URL${BASE_URL}/api/v1/auth/reddit/callback
Scopes / permissionsidentity, submit, mysubreddits, read, flair
Auto token refreshYes — every 7 days before expiry

ENV details

REDDIT_USER_AGENT defaults to Sosyabot/1.0. Reddit's API policy demands a meaningful UA — use the form web:com.example.sosyabot:v3.38.0 (by /u/yourhandle) for production.

How to connect

  1. Open ConnectionsRedditConnect.
  2. Sign in to Reddit and grant the scopes.
  3. Pick the default subreddit on the post-connect screen.

Token refresh

Auto-refreshed. Default access-token TTL is 1 hour. The tokenRefresh.queue.ts worker uses the permanent refresh token to mint new access tokens. The User-Agent header is required on every refresh call.

Notes

  • The User-Agent header is required on every API call, not just connect. Reddit returns 429 for missing or generic User-Agents.
  • Sosyabot caches your subreddit list in data and auto-selects the first subreddit as default at connect time.
  • The flair scope is requested so the composer can list subreddit flairs and let you pick one before posting.

Troubleshooting

If the channel shows needs_reconnect, the access token was rejected by Reddit. Common causes:

  • The user revoked Sosyabot's authorization on the platform.
  • The platform invalidated the token (password change, security event).
  • Your OAuth app credentials rotated and the existing tokens no longer match.

Re-run the connect flow above. See Troubleshooting for the workspace-wide checklist.