Merge branch 'long-life-oauth-tokens' into 'develop'

[#2353] Virtually never-expiring OAuth tokens (new and already issued ones)

Closes #2353

See merge request pleroma/pleroma!3205
This commit is contained in:
rinpatch 2020-12-17 18:34:49 +00:00
commit afc68a052c
2 changed files with 14 additions and 1 deletions

View file

@ -648,7 +648,7 @@
} }
config :pleroma, :oauth2, config :pleroma, :oauth2,
token_expires_in: 3600 * 24 * 30, token_expires_in: 3600 * 24 * 365 * 100,
issue_new_refresh_token: true, issue_new_refresh_token: true,
clean_expired_tokens: false clean_expired_tokens: false

View file

@ -0,0 +1,13 @@
defmodule Pleroma.Repo.Migrations.DataMigrationProlongOAuthTokensValidUntil do
use Ecto.Migration
def up do
expires_in = Pleroma.Config.get!([:oauth2, :token_expires_in])
valid_until = NaiveDateTime.add(NaiveDateTime.utc_now(), expires_in, :second)
execute("update oauth_tokens set valid_until = '#{valid_until}'")
end
def down do
:noop
end
end