-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(oauth): add User-Agent header to Reddit token refresh #2517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(oauth): add User-Agent header to Reddit token refresh #2517
Conversation
|
@majiayu000 is attempting to deploy a commit to the Sim Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR fixes Reddit OAuth token refresh failures by adding the required Key Changes:
The implementation correctly leverages the existing Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant OAuthLib
participant Reddit API
Client->>OAuthLib: refreshOAuthToken('reddit', refreshToken)
OAuthLib->>OAuthLib: getProviderAuthConfig('reddit')
Note over OAuthLib: Creates config with<br/>User-Agent header
OAuthLib->>OAuthLib: buildAuthRequest(config, refreshToken)
Note over OAuthLib: Adds headers:<br/>- Content-Type<br/>- User-Agent (NEW)<br/>- Authorization (Basic Auth)
OAuthLib->>Reddit API: POST /api/v1/access_token<br/>with User-Agent header
alt Success
Reddit API-->>OAuthLib: {access_token, expires_in}
OAuthLib-->>Client: {accessToken, expiresInSeconds}
else Failure (403 without User-Agent)
Reddit API-->>OAuthLib: 403 Forbidden
OAuthLib-->>Client: null
end
|
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@majiayu000 do you mind rebasing so the branch only has your commit |
Reddit API requires User-Agent header for all requests including OAuth token refresh. Without it, requests fail with 403 error after the initial token expires. Fixes simstudioai#1822
3a6a9c9 to
f562bde
Compare
|
Done! Rebased onto the latest staging branch. |
Reddit API requires User-Agent header for all requests including OAuth token refresh. Without it, requests fail with 403 error after the initial token expires. Fixes #1822
Summary
Test plan
Fixes #1822