[英]Spring Security: How to pass oauth2 access token in request headers
On successful login to my spring security application configured with Oauth2, I received a response with Oauth2 token. 成功登录到使用Oauth2配置的spring安全应用程序后,我收到了一个带有Oauth2令牌的响应。
For the subsequent request I passed Oauth2 access_token
in URI Query Parameter like this 对于后续请求,我在URI查询参数中传递了Oauth2
access_token
,如下所示
http://localhost:8090/myapplication/users/user?access_token=4c520795-eb07-4c2d-a91b-474c85fb481e
It is working fine. 它工作正常。
But instead of passing token in URI to make it more secure I wanted to send token in request headers.How to do this? 但是,不是在URI中传递令牌以使其更安全,我想在请求头中发送令牌。如何做到这一点?
Use the usual HTTP Authorization header: 使用通常的HTTP Authorization标头:
Authorization: Bearer <your-token-here>
For example 例如
Authorization: Bearer 4c520795-eb07-4c2d-a91b-474c85fb481e
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.