I am implementing the REST API using the following technologies / approaches:
I want to implement an authentication endpoint, it should get the username and password in the POST request in JSONAPI format and return the JWT token in JSONAPI format. But I see that there are some contradictions that do not allow me to be 100% RESTful:
Let me name the endpoint /tokens , because it actually creates tokens. The answer will also be a resource like tokens , for example:
{ "data": { "type": "tokens", "attributes": { "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEifQ.ivJ5P23wqVo3w31flg3aOu7er--Ijght_RrBf_MuqsU", } } }
But what about the request? username and password are user properties, but they should be sent to the /tokens endpoint. If I send the users resource to the /tokens endpoint, that doesn't make much sense.
Is there a way for this to follow the JSONAPI and keep the API meaningful?
source share