Move ueberauth.config to ueberauth

This commit is contained in:
snewcomer 2018-12-24 07:21:35 -08:00
parent d63a1e4378
commit 0811d76018

View File

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