Generating the Access Token
WSO2 IoT Server APIs are protected through OAuth. Therefore, you need to generate an OAuth token to invoke the APIs. The authorization and access controls are controlled through the API scopes. Follow the steps given below to obtain the access token and renew it one's it expires.
Obtaining the access token
You can obtain an access token by providing the resource owner's username and password as an authorization grant. It requires the base64 encoded string of the consumer-key:consumer-secret
 combination. Let's take a look at how it's done.
Encode the client credentials as follows:
Generate the Client ID and the Secret ID.
Encode the client credentials as follows:
Generate the access token using the following command:
The access token you generated expires in an hour. After it expires you can generate a new access token using the refresh token as shown below.
Generating a new access token from the refresh token
The access token expires in an hour. Let's look at how to use the refresh token to generate a new access token using the cURL command given below.