mirror of https://github.com/mastodon/mastodon
WIP: Support multiple redirect_uris when creating OAuth 2.0 Applications
This brings us more inline with the dynamic client registration specification
This commit is contained in:
parent
476a043fc5
commit
c43497abd4
|
@ -24,6 +24,6 @@ class Api::V1::AppsController < Api::BaseController
|
|||
end
|
||||
|
||||
def app_params
|
||||
params.permit(:client_name, :redirect_uris, :scopes, :website)
|
||||
params.permit(:client_name, :scopes, :website, :redirect_uris, redirect_uris: [])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class REST::ApplicationSerializer < ActiveModel::Serializer
|
||||
attributes :id, :name, :website, :scopes, :redirect_uri,
|
||||
attributes :id, :name, :website, :scopes, :redirect_uri, :redirect_uris,
|
||||
:client_id, :client_secret
|
||||
|
||||
# NOTE: Deprecated in 4.3.0, needs to be removed in 5.0.0
|
||||
|
@ -19,6 +19,18 @@ class REST::ApplicationSerializer < ActiveModel::Serializer
|
|||
object.secret
|
||||
end
|
||||
|
||||
def redirect_uri
|
||||
# Doorkeeper stores the redirect_uri value as a newline delimeted list in
|
||||
# the database, as we may have more than one redirect URI, return the first:
|
||||
object.redirect_uri.split.first
|
||||
end
|
||||
|
||||
def redirect_uris
|
||||
# Doorkeeper stores the redirect_uri value as a newline delimeted list in
|
||||
# the database:
|
||||
object.redirect_uri.split
|
||||
end
|
||||
|
||||
def website
|
||||
object.website.presence
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue