Merge branch 'user-search-nickname-rank-boost' into 'develop'
[akkoma] / lib / pleroma / web / mastodon_api / controllers / account_controller.ex
index fd89faf02152d912e1928709388a87a75e6ad249..7434428558d77ffeb302bd6328664f814995d01d 100644 (file)
@@ -27,6 +27,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
   alias Pleroma.Web.MastodonAPI.MastodonAPI
   alias Pleroma.Web.MastodonAPI.MastodonAPIController
   alias Pleroma.Web.MastodonAPI.StatusView
+  alias Pleroma.Web.OAuth.OAuthView
   alias Pleroma.Web.OAuth.Token
   alias Pleroma.Web.TwitterAPI.TwitterAPI
 
@@ -101,12 +102,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
          :ok <- TwitterAPI.validate_captcha(app, params),
          {:ok, user} <- TwitterAPI.register_user(params, need_confirmation: true),
          {:ok, token} <- Token.create_token(app, user, %{scopes: app.scopes}) do
-      json(conn, %{
-        token_type: "Bearer",
-        access_token: token.token,
-        scope: app.scopes,
-        created_at: Token.Utils.format_created_at(token)
-      })
+      json(conn, OAuthView.render("token.json", %{user: user, token: token}))
     else
       {:error, error} -> json_response(conn, :bad_request, %{error: error})
     end