Krish
Krish

Reputation: 41

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.

For the subsequent request I passed Oauth2 access_token in URI Query Parameter like this

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?

Upvotes: 2

Views: 2308

Answers (1)

Jim.R
Jim.R

Reputation: 743

Use the usual HTTP Authorization header:

Authorization: Bearer <your-token-here>

For example

Authorization: Bearer 4c520795-eb07-4c2d-a91b-474c85fb481e

Upvotes: 4

Related Questions