You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The solution is quite simple, just add a user agent header to the profile request.
However, I'm not sure how best to implement it. You could either set a fixed User-Agent (e.g. remix-auth-app) or forward the User-Agent from the incoming request. I think it makes no sense to have it configured as it probably only affects CloudFlare workers at the moment and other platforms automatically fill in the user agent.
Currently there is an error when you want to use the GitHub Strategy from remix-auth with Cloudflare Workers.
The error occurs when trying to retrieve profile information from the GitHub API. This request fails with an error status of 403. The error occurs because GitHub needs to force a user agent header, which is apparently not sent by the worker fetch. (https://docs.github.com/en/rest/overview/resources-in-the-rest-api#user-agent-required)
The solution is quite simple, just add a user agent header to the profile request.
However, I'm not sure how best to implement it. You could either set a fixed
User-Agent
(e.g. remix-auth-app) or forward theUser-Agent
from the incoming request. I think it makes no sense to have it configured as it probably only affects CloudFlare workers at the moment and other platforms automatically fill in the user agent.remix-auth/src/strategies/github.ts
Lines 120 to 126 in 42642e9
let response = await fetch(this.userInfoURL, { headers: { Accept: "application/vnd.github.v3+json", Authorization: `token ${accessToken}`, + User-Agent: "remix-auth-app" }, });
Heres a example repo with a custom
github.ts
to fix the error.The text was updated successfully, but these errors were encountered: