dimanche 24 septembre 2017

Laravel jwt.auth retrieve token from Body

I want to be able to retrieve the token from the http_request_body as for annoying reasons where I need to send the data from, the token is too long to send as part of the query string, and they don't accept sending headers.

Anyway, I've managed to edit the jwt.auth GetUserFromToken middleware to the following:

if (! $token = $this->auth->setRequest($request)->getToken()) {
    if(! $token = $request->get('token') ) {
        return $this->respond('tymon.jwt.absent', 'token_not_provided', 400);
    }
}

This works, but I am wondering if there is a better way that would be more permanent? Obviously when I deploy or the package is updated this will be over-ridden.

Is there a way to extend to extend or over-ride this class from within my app, rather than directly in the vendor Middleware?

Thanks!



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2fqfbo4
via IFTTT

Aucun commentaire:

Enregistrer un commentaire