oauth: never use base64 padding when returning tokens to applications
The normal Base64 alphabet uses the equals sign (=) as a padding character. Since Base64 strings are self-synchronizing, padding characters are unnecessary, so don't generate them in the first place.
This commit is contained in:
parent
1ef4741861
commit
e9ef4b8da6
4 changed files with 12 additions and 6 deletions
|
|
@ -25,8 +25,14 @@ defmodule Pleroma.Web.OAuth.App do
|
|||
|
||||
if changeset.valid? do
|
||||
changeset
|
||||
|> put_change(:client_id, :crypto.strong_rand_bytes(32) |> Base.url_encode64())
|
||||
|> put_change(:client_secret, :crypto.strong_rand_bytes(32) |> Base.url_encode64())
|
||||
|> put_change(
|
||||
:client_id,
|
||||
:crypto.strong_rand_bytes(32) |> Base.url_encode64(padding: false)
|
||||
)
|
||||
|> put_change(
|
||||
:client_secret,
|
||||
:crypto.strong_rand_bytes(32) |> Base.url_encode64(padding: false)
|
||||
)
|
||||
else
|
||||
changeset
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue