1

I have created Oauth2 server following to this spring-security-oauth-example. How can I get the Oauth2 token from Postman ?

This is the code for Resource Server and this is the code for AuthorizationServerConfig.

I want to understand how can I get the Oauth2 token for clientid = "ClientId" from Postman ? And what these below code signify:

public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdapter { @Autowired private AuthenticationManager authenticationManager; @Override public void configure(AuthorizationServerSecurityConfigurer security) throws Exception { security.tokenKeyAccess("permitAll()") .checkTokenAccess("isAuthenticated()"); } public class ResourceServerConfig extends WebSecurityConfigurerAdapter { http.requestMatchers() .antMatchers("/login", "/oauth/authorize") //what does this do 

application.properties has

 server.port=8081 server.context-path=/auth security.basic.enable=false 
4
  • Do you have a clientID, secret key and other details ? Commented Sep 22, 2019 at 13:15
  • yes it's clearly mentioned in the link AuthorizationServerConfig Commented Sep 22, 2019 at 13:17
  • Do you want only the process how to set oauth2 in the postman ? Is it ok, if I give you steps upto creating new access token option. The data should be filled by you. Commented Sep 22, 2019 at 13:23
  • 1
    yes and a bit of explanation too..how the code in Github would work...Thanks a lot for your time Commented Sep 22, 2019 at 13:25

1 Answer 1

4

The steps to set up the OAuth 2.0 token in Postman.

  1. Open Postman.

  2. Create a new request. Click on "authorization" tab. Screenshot below :

enter image description here

  1. Select Type of authentication as OAuth 2.0. Screenshot below :

enter image description here

  1. Now, click on the "Get New Access Token". It will pop up to show this below :

enter image description here

  1. Enter the desired details like Client ID, Client Secret, CallBack URL, Auth URL, Access Token URL etc.

So, I'm adding some helpful resources for you to understand the OAuth 2.0 Type.

  1. The OAuth 2.0 Authorization Framework - This will give an idea what is OAuth 2.0 Authorization Framework?

A screenshot from the above link : How the Oauth 2.0 Authorization Framework looks like.

enter image description here

  1. Some video lectures to understand it visually :

    a. https://www.youtube.com/watch?v=NRU_KdUSjD4

    b. https://www.youtube.com/watch?v=Dbxzw0cpxBU

Sign up to request clarification or add additional context in comments.

6 Comments

were u able to get access token using the code in Github?
@RahulRaj I have added the video of the code owner. He has published a video tutorial on this. Please checkout.
B can you just what is the responsibility of Autherisation server and Resource server?
Resource server keeps all the resources which needs to be protected. Based on the access token, it provides the protected resource. On the other hand, the authorization server gives an access token from resource owner through which you can get access to the protected resource from resource server
Suppose i am hitting an /api/hsbc/account and hsbc directs me for authentican to Google .then which is the server resource server here
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.