Spring security OAuth2 accept JSON

前端 未结 6 1852
深忆病人
深忆病人 2020-12-09 00:56

I am starting with Spring OAuth2. I would like to send the username and password to /oauth/token endpoint in POST body in application/json format.

curl -X PO         


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-09 01:20

    With Spring Security 5 I only had to add .allowFormAuthenticationForClients() + the JsontoUrlEncodedAuthenticationFilter noted in the other answer to get it to accept json in addition to x-form post data. There was no need to register the resource server or anything.

提交回复
热议问题