mardi 17 mai 2016

JWT signature's verification at resource-server side in laravel

Can I do this

  1. Have one (hosted on mydomain/public) laravel Api with the purpose of authenticating the user and getting a JWT token. i.e authentication server
  2. Somehow passing this same Token to a second (hosted on mydomain/secure) laravel Api in order to authenticate the user and the access the App. i.e resource server

I have tried to do that using the this package. As I asked above I have done authentication on authentication server as described here and token had been generated and I had added some data to the token that is required in resource server. And I passed that token to the resource server and try to parse the token I get the error like Token has expired So , my question is :

  1. How can I do verification of JWT signature's at resource-server side?
  2. Is it possible to do using JWT?

Code I had tried to parse the token in resource server

Route::get("/parse/token",function(Request $request){
    $token = JWTAuth::getToken();
    $user = JWTAuth::toUser($token);
    return $user ; 
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire