projects
/
akkoma
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0fd176b
)
Parse access_token from body parameters and URL parameters
author
AkiraFukushima
<h3.poteto@gmail.com>
Thu, 2 May 2019 12:04:00 +0000
(21:04 +0900)
committer
AkiraFukushima
<h3.poteto@gmail.com>
Thu, 2 May 2019 12:04:00 +0000
(21:04 +0900)
lib/pleroma/plugs/oauth_plug.ex
patch
|
blob
|
history
diff --git
a/lib/pleroma/plugs/oauth_plug.ex
b/lib/pleroma/plugs/oauth_plug.ex
index 5888d596aaaf4ae89df271be0166eabb13b75152..9d43732eb43592cbafe41c6f2a08c947836ee44c 100644
(file)
--- a/
lib/pleroma/plugs/oauth_plug.ex
+++ b/
lib/pleroma/plugs/oauth_plug.ex
@@
-16,6
+16,16
@@
defmodule Pleroma.Plugs.OAuthPlug do
def call(%{assigns: %{user: %User{}}} = conn, _), do: conn
+ def call(%{params: %{"access_token" => access_token}} = conn, _) do
+ with {:ok, user, token_record} <- fetch_user_and_token(access_token) do
+ conn
+ |> assign(:token, token_record)
+ |> assign(:user, user)
+ else
+ _ -> conn
+ end
+ end
+
def call(conn, _) do
with {:ok, token_str} <- fetch_token_str(conn),
{:ok, user, token_record} <- fetch_user_and_token(token_str) do