Skip to content

Commit

Permalink
Ensure Facebook returns application/json content type
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultzer committed Dec 29, 2024
1 parent a166204 commit ef7087f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* `Assent.Strategy.OIDC` now supports `none` authentication method
* `Assent.Strategy.Bitbucket` added
* `Assent.Strategy.Twitch` added
* `Assent.Strategy.Facebook.fetch_user/2` fixed bug with user not being decoded
* `Assent.Strategy.OAuth2` now supports PKCE
* `Assent.Strategy.OAuth2.Base.authorize_url/2` incomplete typespec fixed
* `Assent.Strategy.decode_response/2` deprecated accepting result tuples and now accepts `Assent.HTTPAdapter.HTTPResponse` structs
Expand Down
2 changes: 1 addition & 1 deletion lib/assent/strategies/facebook.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ defmodule Assent.Strategy.Facebook do
access_token: access_token["access_token"]
]

OAuth2.fetch_user(config, access_token, params)
OAuth2.fetch_user(config, access_token, params, [{"accept", "application/json"}])
end
end

Expand Down
2 changes: 2 additions & 0 deletions test/assent/strategies/facebook_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ defmodule Assent.Strategy.FacebookTest do
end)

expect_oauth2_user_request(@user_response, [uri: "/me"], fn conn ->
assert Plug.Conn.get_req_header(conn, "accept") == ["application/json"]

conn = Plug.Conn.fetch_query_params(conn)

assert conn.params["access_token"] == "access_token"
Expand Down

0 comments on commit ef7087f

Please sign in to comment.