1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Web.OAuth.OAuthView do
7 import Phoenix.HTML.Form
9 alias Pleroma.Web.Gettext
11 alias Pleroma.Web.OAuth.Token.Utils
13 def render("token.json", %{token: token} = opts) do
17 access_token: token.token,
18 refresh_token: token.refresh_token,
19 expires_in: NaiveDateTime.diff(token.valid_until, NaiveDateTime.utc_now()),
20 scope: Enum.join(token.scopes, " "),
21 created_at: Utils.format_created_at(token)
24 if user = opts[:user] do
26 |> Map.put(:me, user.ap_id)