-
Notifications
You must be signed in to change notification settings - Fork 371
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates omniauth because GitHub is deprecating query params which is used by the old omniauth. To do this I updated to Omniauth 2+ which also required an update of devise. There's a change to the omniauth API which is talked about here: heartcombo/devise#5236 Basically: - Omniauth2 requires post (instead of GET) - Omniauth 2 also needs this `omniauth-rails_csrf_protection` gem. I added the gem and updated all `link_to` and `button_to` to include a `method: :post`. There is one controller redirect which apparently still seems to work, but it might be broken. I'm not sure how we could possibly preserve the existing behavior since you cannot redirect to a post. This gets tests to pass though. So it's good enough for the short term. ## Deprecation Email from GitHub ``` [GitHub API] Deprecation notice for authentication via URL query parameters GitHub Mar 6, 2021, 4:37 AM (5 days ago) to Richard Hi @schneems, On March 6th, 2021 at 10:37 (UTC) your application (CodeTriage) used an access token (with the User-Agent Faraday v0.17.3) as part of a query parameter to access an endpoint through the GitHub API: https://api.github.com/user Please use the Authorization HTTP header instead as using the `access_token` query parameter is deprecated. Depending on your API usage, we'll be sending you this email reminder on a monthly basis. Visit https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param for more information about suggested workarounds and removal dates. Thanks, The GitHub Team ``` Need to use devise from GitHub due to this not being released yet heartcombo/devise#5327 # This is the commit message #2: WIP Move omniauth links to post Omniauth 2 requires post. heartcombo/devise#5236 ``` Install the gem OmniAuth - Rails CSRF Protection Add the link user_facebook_omniauth_authorize_path method: :post ``` TODO: Convert the rest of the links to `user_github_omniauth_authorize_path` to be post
- Loading branch information
Showing
14 changed files
with
70 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,22 +30,24 @@ class ActionDispatch::IntegrationTest | |
end | ||
|
||
OmniAuth.config.test_mode = true | ||
OmniAuth.config.add_mock(:github, { | ||
uid: 'mockstar', | ||
credentials: { | ||
token: ENV['GITHUB_API_KEY'] || "d401116495671f0a0ceca9276e677eff" | ||
}, | ||
email: "[email protected]", | ||
info: { | ||
nickname: 'mockstar' | ||
}, | ||
extra: { | ||
raw_info: { | ||
name: "Mock Star", | ||
avatar_url: "http://gravatar.com/avatar/default" | ||
} | ||
} | ||
}) | ||
OmniAuth.config.add_mock( | ||
:github, { | ||
uid: 'mockstar', | ||
credentials: { | ||
token: ENV['GITHUB_API_KEY'] || "d401116495671f0a0ceca9276e677eff" | ||
}, | ||
email: "[email protected]", | ||
info: { | ||
nickname: 'mockstar' | ||
}, | ||
extra: { | ||
raw_info: { | ||
name: "Mock Star", | ||
avatar_url: "http://gravatar.com/avatar/default" | ||
} | ||
} | ||
} | ||
) | ||
|
||
VCR.configure do |c| | ||
# This 'allow' should be temporary, work towards covering | ||
|
@@ -68,7 +70,8 @@ def login_via_github | |
# Works based off of omniauth's mock | ||
# The user will be looked up from the database and updated | ||
# based off of the info in the mock. | ||
visit "/users/auth/github" | ||
visit "/" | ||
click_on "Log in" | ||
end | ||
end | ||
end | ||
|