I have my OAuth server and client which is being authorized by Oauth2.
Now if I need to call my service I need to:
Generate access token from the server using below API :
localhost:9191/oauth/token?grant_type=password&username=krish&password=kpass
Which is giving response like :
"access_token": "ee41435d-8ad9-432e-82c1-07477e2b6956", "token_type": "bearer", "refresh_token": "ea6d83b4-62f6-4eaf-9f89-8600bd36690d", "expires_in": 3429, "scope": "READ WRITE"
Now I am passing access token, to run the client service like below:
So this is manually I am doing it. But I need to run it from the client code. When I am trying to hit the first API itself (server) to get the token, it is saying unauthorized.
My service code is below :
I need to skip the authentication from the /getToken
controller. How can I do that? Can anyone please help
My WebSecurityConfigurerAdapter class is as below: I added highlighted code after reading one answer below, but that also not working.