PrincewillIroka / login-with-github

An app that implements "Login with GitHub" functionality in React JS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

access token passed in url problem

john012343210 opened this issue · comments

`https://api.github.com/user?access_token=${access_token}&scope=${scope}&token_type=${token_type}`

Deprecation Notice: GitHub will discontinue authentication to the API using query parameters. Authenticating to the API should be done with HTTP basic authentication. Using query parameters to authenticate to the API will no longer work on May 5, 2021. For more information, including scheduled brownouts, see the blog post.

Probably because of security issue, passing access token in the url is no longer supported by github,
please kindly put the access token in the authorization header

since there is no point in passing the scope and token_type (useless parameter)

An example that is working could be like (tested successfully in my computer)

return fetch(
              `https://api.github.com/user`,{
                    headers: {
                        Authorization: `token ${access_token}`
                    }
                }
            );

@AronWater thanks for the info. I've fixed it and pushed new changes.