Spring boot Oauth 2 configuration cause to 401 even with the permitall antMatchers

北城余情 提交于 2019-12-12 03:34:33

问题


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

回答1:


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'



来源:https://stackoverflow.com/questions/42872316/spring-boot-oauth-2-configuration-cause-to-401-even-with-the-permitall-antmatche

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!