0

I am little new Spring boot and Aouth 2. I tried to secure my spring boot application with OAuth2. But My authentication is nit working and it causes for 401 error even with unsecured url. My code can be found in the git hub with under url

I used the below curl command

curl -i http://localhost:8990/api/hello

But it results for

{"timestamp":1489824873836,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource","path":"/api/hello"}

Also when I try to access my secured url as below, it produces the same error.

curl -i -H "Authorization: Bearer <access_token>" http://localhost:8990/api/secure

I have searched in the internet but unable to fix my problem yet. Could anybody please help me

Thanks

Git hub url

https://github.com/txmr765/Spring-Oauth2
Dilee
  • 246
  • 1
  • 4
  • 15

1 Answers1

2

Authentication code has got few things to be changed and now and it's working.

Just check curl -vu secureapp:secret 'http://localhost:8990/api/oauth/token?username=admin&password=admin&grant_type=password'

Dilan
  • 1,389
  • 5
  • 14
  • 24