Merge pull request #27 from snewcomer/sn/json-config

Configurable json library
This commit is contained in:
Yordis Prieto 2019-03-12 21:23:03 -07:00 committed by GitHub
commit c9a090210d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -105,13 +105,13 @@ defmodule Ueberauth.Strategy.Twitter do
{:ok, %{status_code: 401, body: _, headers: _}} ->
set_errors!(conn, [error("token", "unauthorized")])
{:ok, %{status_code: status_code, body: body, headers: _}} when status_code in 200..399 ->
body = Poison.decode!(body)
body = Ueberauth.json_library().decode!(body)
conn
|> put_private(:twitter_token, token)
|> put_private(:twitter_user, body)
{:ok, %{status_code: _, body: body, headers: _}} ->
body = Poison.decode!(body)
body = Ueberauth.json_library().decode!(body)
error = List.first(body["errors"])
set_errors!(conn, [error("token", error["message"])])
end

View File

@ -19,7 +19,7 @@ defmodule Ueberauth.Strategy.Twitter.OAuth do
def access_token({token, token_secret}, verifier, opts \\ []) do
opts
|> client
|> client()
|> to_url(:access_token)
|> Internal.get([{"oauth_verifier", verifier}], consumer(client()), token, token_secret)
|> decode_response
@ -34,7 +34,7 @@ defmodule Ueberauth.Strategy.Twitter.OAuth do
def authorize_url!({token, _token_secret}, opts \\ []) do
opts
|> client
|> client()
|> to_url(:authorize_url, %{"oauth_token" => token})
end