Merge branch 'feature/add-oauth-tokens-endpoint' into 'develop'

Add OAuth tokens endpoint

See merge request pleroma/pleroma!805
This commit is contained in:
kaniini 2019-02-18 04:02:41 +00:00
commit 7456338ed3
6 changed files with 109 additions and 1 deletions

View file

@ -227,4 +227,17 @@ defmodule Pleroma.Factory do
unreachable_since: nil
}
end
def oauth_token_factory do
user = insert(:user)
oauth_app = insert(:oauth_app)
%Pleroma.Web.OAuth.Token{
token: :crypto.strong_rand_bytes(32) |> Base.url_encode64(),
refresh_token: :crypto.strong_rand_bytes(32) |> Base.url_encode64(),
user_id: user.id,
app_id: oauth_app.id,
valid_until: NaiveDateTime.add(NaiveDateTime.utc_now(), 60 * 10)
}
end
end