Skip to content
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

Two apis of github oauth changed which cause login failed #139

Merged
merged 1 commit into from
Dec 16, 2020

Conversation

tufatao
Copy link
Contributor

@tufatao tufatao commented Dec 8, 2020

Fixes : [issue-number]

Description :

  1. The api "https://api.github.com/user/emails" no longer supported the parameter "access_token" in query;
  2. The api "https://api.github.com/user" no longer supported the parameter "access_token" in query;

image

Resolve:

I modified the function "AuthGithub" in account.go according to the github rest api.
1. put the parameter "Authorization" with the value of "access_token" in header instead of in query;
2. add the parameter "access" with the recommended value "application/vnd.github.v3+json" in header;

image

Screenshot of changes :

image

Please ensure Checkmark the following :

  • - Tested Localy
  • - Checked in IE11 and Firefox
  • - Checked in mobile
  • - Backend work
  • - Frontend work
  • - Bug Fixes
  • - Enhancements

Issue:
    1. Api "https://api.github.com/user/emails" 不再支持 query params 方式追加 access_token参数;
    2. Api "https://api.github.com/user" 不再支持 query params 方式追加 access_token参数;

Resolve:
    以上两接口均按 [github 文档-user](https://docs.github.com/en/free-pro-team@latest/rest/reference/users#list-email-addresses-for-the-authenticated-user)改为 在 header 中 添加
      - ("Authorization", "token " + access_token);
      - ("access", "application/vnd.github.v3+json");
    得以解决。
@hsluoyz
Copy link
Member

hsluoyz commented Dec 8, 2020

@tufatao hi, can you modify the PR title and text into English?

@tufatao tufatao changed the title Title: 解决因 github oauth 相关接口变更导致登录失败的问题 Two oauth apis of github changed cause oauth login failed Dec 8, 2020
@tufatao tufatao changed the title Two oauth apis of github changed cause oauth login failed Two apis of github changed cause oauth login failed Dec 8, 2020
@tufatao tufatao changed the title Two apis of github changed cause oauth login failed Two interfaces of github changed which cause oauth login failed Dec 8, 2020
@tufatao tufatao closed this Dec 8, 2020
@hsluoyz
Copy link
Member

hsluoyz commented Dec 8, 2020

@tufatao why closed?

@tufatao tufatao changed the title Two interfaces of github changed which cause oauth login failed Two apis of github oauth changed which cause login failed Dec 9, 2020
@tufatao tufatao reopened this Dec 9, 2020
@hsluoyz
Copy link
Member

hsluoyz commented Dec 16, 2020

lgtm

@hsluoyz hsluoyz merged commit 7882b1f into casbin:master Dec 16, 2020
@hsluoyz
Copy link
Member

hsluoyz commented Dec 16, 2020

@tufatao thanks for contributing to Casbin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants