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.https://github.com/sergiodxa/remix-auth/blob/42642e9c77a234a5227fda9b5ce17dc745416402/src/strategies/github.ts#L120-L126
Heres a example repo with a custom
github.ts
to fix the error.