Browse Source

Preserve state in oauth

tags/v0.9.9
Roger Braun 6 years ago
parent
commit
ac3f32da7e
2 changed files with 8 additions and 1 deletions
  1. +7
    -1
      lib/pleroma/web/oauth/oauth_controller.ex
  2. +1
    -0
      lib/pleroma/web/templates/o_auth/o_auth/show.html.eex

+ 7
- 1
lib/pleroma/web/oauth/oauth_controller.ex View File

@@ -10,7 +10,8 @@ defmodule Pleroma.Web.OAuth.OAuthController do
response_type: params["response_type"],
client_id: params["client_id"],
scope: params["scope"],
redirect_uri: params["redirect_uri"]
redirect_uri: params["redirect_uri"],
state: params["state"]
}
end

@@ -25,6 +26,11 @@ defmodule Pleroma.Web.OAuth.OAuthController do
}
else
url = "#{redirect_uri}?code=#{auth.token}"
url = if params["state"] do
url <> "&state=#{params["state"]}"
else
url
end
redirect(conn, external: url)
end
end


+ 1
- 0
lib/pleroma/web/templates/o_auth/o_auth/show.html.eex View File

@@ -10,5 +10,6 @@
<%= hidden_input f, :response_type, value: @response_type %>
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
<%= hidden_input f, :scope, value: @scope %>
<%= hidden_input f, :state, value: @state%>
<%= submit "Authorize" %>
<% end %>

Loading…
Cancel
Save