-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from danschultzer/oauth2-post-params
Put OAuth 2 POST params in body
- Loading branch information
Showing
5 changed files
with
25 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,13 +19,14 @@ defmodule PowAssent.Strategy.OAuth2Test do | |
|
||
test "normalizes data", %{config: config, callback_params: params, bypass: bypass} do | ||
expect_oauth2_access_token_request(bypass, [], fn conn -> | ||
conn = Plug.Conn.fetch_query_params(conn) | ||
|
||
assert conn.params["grant_type"] == "authorization_code" | ||
assert conn.params["response_type"] == "code" | ||
assert conn.params["code"] == "test" | ||
assert conn.params["client_secret"] == "secret" | ||
assert conn.params["redirect_uri"] == "test" | ||
{:ok, body, _conn} = Plug.Conn.read_body(conn, []) | ||
params = URI.decode_query(body) | ||
|
||
assert params["grant_type"] == "authorization_code" | ||
assert params["response_type"] == "code" | ||
assert params["code"] == "test" | ||
assert params["client_secret"] == "secret" | ||
assert params["redirect_uri"] == "test" | ||
end) | ||
|
||
expect_oauth2_user_request(bypass, %{name: "Dan Schultzer", email: "[email protected]", uid: "1"}) | ||
|
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 |
---|---|---|
|
@@ -38,7 +38,10 @@ defmodule PowAssent.Strategy.VKTest do | |
|
||
test "normalizes data", %{config: config, callback_params: params, bypass: bypass} do | ||
expect_oauth2_access_token_request(bypass, [uri: "/access_token", params: %{"access_token" => "access_token", "email" => "[email protected]"}], fn conn -> | ||
assert conn.query_string =~ "scope=email" | ||
{:ok, body, _conn} = Plug.Conn.read_body(conn, []) | ||
params = URI.decode_query(body) | ||
|
||
assert params["scope"] == "email" | ||
end) | ||
|
||
expect_oauth2_user_request(bypass, %{"response" => @users_response}, [uri: "/method/users.get"], fn conn -> | ||
|