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

Deprecation notice for authentication via URL query parameters #135

Closed
Xiaoyang-Gu opened this issue Nov 2, 2020 · 3 comments
Closed

Deprecation notice for authentication via URL query parameters #135

Xiaoyang-Gu opened this issue Nov 2, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Xiaoyang-Gu
Copy link
Contributor

Some users mentioned they encounter with the error [E] [account.go:97] json: cannot unmarshal object into Go value of type []controllers.userEmailFromGithub
This because the Casbin-dashboard used an access token (with the User-Agent Go-http-client/1.1) as part of a query parameter to access an endpoint through the GitHub API: https://api.github.com/user/emails https://api.github.com/user and using the access_token query parameter is deprecated.
To fix this bug, the GitHub Team recommended to use the Authorization HTTP header instead.

@hsluoyz
Copy link
Member

hsluoyz commented Nov 2, 2020

@438561537 how to fix this issue?

@hsluoyz hsluoyz self-assigned this Nov 2, 2020
@hsluoyz hsluoyz added the bug Something isn't working label Nov 2, 2020
@Xiaoyang-Gu
Copy link
Contributor Author

@hsluoyz I had made the pr #136 to fix this issue.
As the Github team mentioned, I use the Authorization HTTP header request1, _ := http.NewRequest("GET", "https://api.github.com/user/emails", nil) request1.Header.Set("Authorization", "token "+token.AccessToken) instead of using access_token as part of a query parameter response, err := http.Get("https://api.github.com/user/emails?access_token=" + token.AccessToken).

@hsluoyz
Copy link
Member

hsluoyz commented Dec 18, 2020

Fixed by: #139

@hsluoyz hsluoyz closed this as completed Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants