The my2cloud portal consumes all its data points via token-based authentication. Any application can authenticate and use any functionality in the application as API. For instance, you can create your own web application that consumes data from the my2cloud APIs. In this section, we'll demonstrate usage of the API from Postman (a Google Chrome extension).
We suggest you disable two factor authentication for the user which will be used for remote authentication, otherwise the two factor authentication flow will be implemented by the API.
The Following headers should be configured for all requests (
Abp.TenantId should be set to the Id of your my2cloud tenant.
Then we can send our username and password as a POST request to https://my2cloud.net:44301/api/TokenAuth/Authenticate
In the JSON response, we need to save the
accessToken which will be used to authorize access to the API.
After we authenticate and get the access token, we can use it to call any authorized actions. All services are available to be used remotely. For example, we can use the User service to get a list of users:
We sent a GET request to https://my2cloud.net:44301/api/services/app/User/GetUsers ensuring the Authorization header is set as "Bearer <accessToken>". The result is a JSON response that contains the list of all users.