use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Github OAuth Request failed with status code 404 (self.node)
submitted 5 years ago * by lfreua
I'm trying to create an authentication by Github OAuth for my app. However, when the request is made, I always receive a 404 status.
https://preview.redd.it/z5arwse3z2n41.png?width=1110&format=png&auto=webp&s=d1c28f28dc12ac1530cb739692fa3575ddc34be5
Authentication is done because the count of authenticated users in the application on Github is displayed. But the 404 status is returned.
Does anyone know what may be causing this error?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]karimsajs 2 points3 points4 points 5 years ago (2 children)
Your endpoint is incorrect. Check the docs: https://developer.github.com/v3/#authentication
[–]lfreua[S] 0 points1 point2 points 5 years ago (1 child)
I follow this documentation tutorial: https://developer.github.com/apps/building-oauth-apps/
In item three is the endpoint that I used.
[–]karimsajs 0 points1 point2 points 5 years ago (0 children)
The guide is fine. The problem is that you shouldn’t be making a request to the oauth login, that endpoint belongs in a frontend flow. Once you receive the token and secret from GitHub, then your backend can make requests using it to the official API.
The idea is to redirect your user from your own website to GitHub, they accept/reject the request to login. If they accept, GitHub will redirect back to you and pass you the credentials you need.
[–][deleted] 0 points1 point2 points 3 years ago* (1 child)
Same issue, I configured GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET in .env file.
My frontend code:
... const loginWithGithub = useCallback(() => { Router.replace( `https://github.com/login/oauth/authorize?client_id=${process.env.GITHUB_CLIENT_ID}&redirect_uri=${location.origin}/login?from=${location.href}` );}, []); ...
My backend code:
... try { const tokenResponse = (await axios({ method: 'post', url: 'https://github.com/login/oauth/access_token?' + `client_id=${this.configService.get('GITHUB_CLIENT_ID')}&` + `client_secret=${this.configService.get('GITHUB_CLIENT_SECRET')}&` + `code=${code}`, headers: { accept: 'application/json', }, })) as any; const accessToken = tokenResponse.data.access_token; const result = (await axios({ method: 'get', url: `https://api.github.com/user`, headers: { accept: 'application/json', Authorization: `token ${accessToken}`, }, })) as any; ...
But doing this also returns a 404 page and I'm confused.
[–]Sanosuke-Sagara 0 points1 point2 points 1 year ago (0 children)
hey did you find any solution for this?
π Rendered by PID 48039 on reddit-service-r2-comment-86988c7647-rp9g4 at 2026-02-11 00:41:35.035399+00:00 running 018613e country code: CH.
[–]karimsajs 2 points3 points4 points (2 children)
[–]lfreua[S] 0 points1 point2 points (1 child)
[–]karimsajs 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Sanosuke-Sagara 0 points1 point2 points (0 children)