aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/mastodon_api/controllers
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-07-09 13:10:05 +0000
committerlain <lain@soykaf.club>2020-07-09 13:10:05 +0000
commit8ca1f3e8c61b906387e9cb6fb8993d2ad496ab3d (patch)
treebbacb00a4ef2ae1a1c79b87ebf036baea3e4e6cc /lib/pleroma/web/mastodon_api/controllers
parentf4469dc7419288a46512ea5cae6ffe32de5d47c2 (diff)
parent59540131c189afb10faf98d1bfeccf8f94985a90 (diff)
downloadpleroma-8ca1f3e8c61b906387e9cb6fb8993d2ad496ab3d.tar.gz
Merge branch '1723-token-fixes' into 'develop'
AccountController: Return scope in proper format. Closes #1723 See merge request pleroma/pleroma!2694
Diffstat (limited to 'lib/pleroma/web/mastodon_api/controllers')
-rw-r--r--lib/pleroma/web/mastodon_api/controllers/account_controller.ex8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
index fd89faf02..743442855 100644
--- a/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
+++ b/lib/pleroma/web/mastodon_api/controllers/account_controller.ex
@@ -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