Call ConfirmUserPlug from Router, not Endpoint
[akkoma] / lib / pleroma / web / o_auth / o_auth_view.ex
index f55247ebd75df014224e401924cf05cf886e7193..d22b2f7fe56f3e22a5b1cc74127cb280ab9a0e51 100644 (file)
@@ -13,7 +13,7 @@ defmodule Pleroma.Web.OAuth.OAuthView do
       token_type: "Bearer",
       access_token: token.token,
       refresh_token: token.refresh_token,
-      expires_in: expires_in(),
+      expires_in: NaiveDateTime.diff(token.valid_until, NaiveDateTime.utc_now()),
       scope: Enum.join(token.scopes, " "),
       created_at: Utils.format_created_at(token)
     }
@@ -25,6 +25,4 @@ defmodule Pleroma.Web.OAuth.OAuthView do
       response
     end
   end
-
-  defp expires_in, do: Pleroma.Config.get([:oauth2, :token_expires_in], 600)
 end