Getting access tokens

Create a POST request from the top inbox and put down the http://localhost:8081/oauth/token URL. This is the default POST URL to get the token.

Add three parameters—username=sunnatpassword=password, and grant_type=password—in the Multipart window:

You can find the information of username and password in the SecurityConfiguration class, and grant_type will be found in AuthorizationServerConfig. Here, we're using the password grant type.

Go to the Basic window and input the username and password. You can find this information in the AuthorizationServerConfig class, where the username is mentioned in withClient() and the password is secret().

We added an image of the Insomnia tool where we wrote down the username and password. Now click the send button. If there are no errors, you'll get the following access_token:

You can see the access_token that will be used to access the protected resources. expires_in means that after 4469 seconds the token will expire. "scope": "read write trust" means you can read, write, and modify the resources.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.217.17