Decode bearer token
This commit is contained in:
parent
385997701f
commit
c28ef2466c
1 changed files with 3 additions and 2 deletions
|
@ -116,8 +116,9 @@ defmodule ComfycampWeb.UserAuth do
|
|||
"""
|
||||
def fetch_bearer_token(conn, _opts) do
|
||||
case Plug.Conn.get_req_header(conn, "authorization") do
|
||||
["Bearer " <> header] ->
|
||||
user = Accounts.get_user_by_bearer_token(header)
|
||||
["Bearer " <> b64token] ->
|
||||
token = Base.decode64(b64token)
|
||||
user = Accounts.get_user_by_bearer_token(token)
|
||||
assign(conn, :oauth_user, user)
|
||||
|
||||
_ ->
|
||||
|
|
Loading…
Reference in a new issue