...
Click on the user icon in the upper right corner and select an option </> API.
Click on OAuth2 Application.
The OAuth2 application defines the requester for access to the application interface. Only full access accounts can create the application. The application can be used to authorize any system account.
When creating an application, you need to enter the following information:
name - any name, e.g. "My application"
application description - any description
list of redirect URLs - The URL to which the user is redirected after authorization
After OAuth2 is created, the application is generated:
...
Request parameters:
Parameter | Description |
---|---|
| Identifies the client application |
| Comma-separated list of required rights. Possible rights are:
|
| URL to which the authorization code should be sent. It must be the same as the URL allowed in the client application definition. |
| Optional security parameter that is passed back to redirect_url without change along with the authorization code. |
First, you are redirected to the portal login screen, and after logging in to your CamStreamer Cloud account, a dialog is displayed asking you to grant access to the client application. After confirming/rejecting the dialog, the redirect_url is redirected and the "code" parameter with the authorization code or the "error" parameter with the reason for the error is added to the GET parameters ("access_denied" if the user has rejected the access request).
If the "state" parameter was specified in the request, it will be added to the redirection as well.
Obtaining an access token
The endpoint https://system2.netrex.cz/oauth2/token is used to obtain the access token and possibly also the refresh token.
Code Block |
---|
POST:
https://system2.netrex.cz/oauth2/token?client_id=CLIENT_ID&client_secret=CLIENT_SECRET&grant_type=authorization_code&code=AUTHORIZATION_CODE&redirect_uri=CALLBACK_URL |
Parameter | Description |
---|---|
| Identifies the client application |
| The secret key of the client application, with the use of which it is possible to obtain permanent access to the API (access and refresh tokens). |
| Ont of the redirect URLs listed in the client application definition. In this step, it only serves as an additional security feature an no futher redirection occurs. |
| Parameter specifying the authorization method. The following options are available:
This is the exchange of the authorization code from the previous step for an access token.
This is a renewal or exchange for a new, access token for the next period. |
Possible answers in JSON format:
{"access_token":"ACCESS_TOKEN","expires_in":3600,"refresh_token":"1234"}
- unlimited time access to the API. When the access token expires, a new one can be obtained by refreshing the token. For this type of access, you must use client_secret in the query.Code Block language json {"access_token":"ACCESS_TOKEN","expires_in":3600,"refresh_token":"1234"}
- unlimited time access to the API. When the access token expires, a new one can be obtained by refreshing the token. For this type of access, you must use client_secret in the query.
{"access_token":"ACCESS_TOKEN","expires_in":3600}
- One-time access to the API, canceled when the access token expires.{"error":"Error message"}
- Invalid request or system error.
The obtained ACCESS_TOKEN can be inserted into the header of each Graph API call (“Authorization: Bearer TOKEN”).
Cancel access token
The access token can be canceled at any time in the user interface or using the API. The endpoint https://system2.netrex.cz/oauth2/revoke is used to cancel the access.
Code Block |
---|
POST:
https://system2.netrex.cz/oauth2/revoke?access_token=ACCESS_TOKEN |
\uD83D\uDCCB Related articles
...