So, You are pretty much correct with JWT. All you need to do when sending data from client to server (after JWT creation), is to add it to the request header. Many folks will try to keep along the same path as OAuth and add a Bearer token similar to the node snippet below:
var rp = require('request-promise');
options = {
method: GET,
uri: 'https://www.example.com/api/sample',
headers: {
Authorization: "Bearer <insert_your_JWT_here>"
}
}
rp(options).then(function(res){
<handle_response>
}
Granted I know you mentioned PHP, but the workflows are the same, its just the syntax is different.
Now, to verify that this token is present, the server would need to verify() that the token is valid with the secret that was defined. In every request made by the client, for an authorized endpoint, you would need to send this token everytime.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…