forked from AkkomaGang/akkoma
OAuth: Set created_at
in token exchange response
(for compatibility with Mastodon)
This commit is contained in:
parent
b60d232719
commit
ad2a7972e7
1 changed files with 3 additions and 1 deletions
|
@ -60,11 +60,13 @@ def token_exchange(conn, %{"grant_type" => "authorization_code"} = params) do
|
|||
fixed_token = fix_padding(params["code"]),
|
||||
%Authorization{} = auth <-
|
||||
Repo.get_by(Authorization, token: fixed_token, app_id: app.id),
|
||||
{:ok, token} <- Token.exchange_token(app, auth) do
|
||||
{:ok, token} <- Token.exchange_token(app, auth),
|
||||
{:ok, inserted_at} <- DateTime.from_naive(token.inserted_at, "Etc/UTC") do
|
||||
response = %{
|
||||
token_type: "Bearer",
|
||||
access_token: token.token,
|
||||
refresh_token: token.refresh_token,
|
||||
created_at: DateTime.to_unix(inserted_at),
|
||||
expires_in: 60 * 10,
|
||||
scope: "read write follow"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue