Session
Sessions deal with access tokens over time. Only one session token can currently be used at a time.
Login prerequisite
You need to retrieve a client id and secret before logging in.
Response
successful operation
Login
With your client id and secret, you can retrieve an access and refresh tokens.
Body
client_ idstringrequiredv1ikx5hnfop4mdpnci8nsqh93c45rldfclient_ secretstringrequiredAjWiOapPltI6EnsWQwlFarRtLh4u8tDtgrant_ typestringpasswordrequiredimmutable name of the user, used to find or mention its actor
chocobozzzpasswordpassword<password>externalAuthTokenstringIf you want to authenticate using an external authentication token you got from an auth plugin (like peertube-plugin-auth-openid-connect for example) instead of a password or a refresh token, provide it here.
client_ idstringrequiredv1ikx5hnfop4mdpnci8nsqh93c45rldfclient_ secretstringrequiredAjWiOapPltI6EnsWQwlFarRtLh4u8tDtgrant_ typestringrefresh_tokenrequiredrefresh_ tokenstringrequired2e0d675df9fc96d2e4ec8a3ebbbf45eca9137bb7Parameters
x-peertube-otpstringheaderIf the user enabled two factor authentication, you need to provide the OTP code in this header
Response
successful operation
Disambiguate via code:
invalid_clientfor an unmatchedclient_idinvalid_grantfor unmatched credentials
Disambiguate via code:
- default value for a regular authentication failure
invalid_tokenfor an expired tokenmissing_two_factorif two factor header is missing
Logout
Revokes your access token and its associated refresh token, destroying your current session.
Response
successful operation
Authorization
OAuth2oauth2Authenticating via OAuth requires the following steps:
- Have an activated account
- Generate an access token for that account at
/api/v1/users/token. - Make requests with the Authorization: Bearer <token> header
- Profit, depending on the role assigned to the account
Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.
List token sessions
Parameters
Entity id
Response
successful operation
Authorization
OAuth2oauth2Authenticating via OAuth requires the following steps:
- Have an activated account
- Generate an access token for that account at
/api/v1/users/token. - Make requests with the Authorization: Bearer <token> header
- Profit, depending on the role assigned to the account
Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.
Revoke a token session
Response
successful operation
Authorization
OAuth2oauth2Authenticating via OAuth requires the following steps:
- Have an activated account
- Generate an access token for that account at
/api/v1/users/token. - Make requests with the Authorization: Bearer <token> header
- Profit, depending on the role assigned to the account
Note that the access token is valid for 1 day and is given along with a refresh token valid for 2 weeks.
