Exception url in Laravel token?

Asked

Viewed 269 times

1

In my project I need to release a url for a service rest I’m implementing, only I’m not getting to make the exception of token for this route, since I will not receive you in the service.

In the Verifycsrftoken file, you already have the $except attribute for the route, but it’s not helping:

protected $except = [
    'wallet/*'
];

This is how the routing is:

Route::post('wallet/apple/v1/devices/{device}/registrations/{registration}/{redNumber}', 'Service\AppleWalletController@register');

Keeps making the same mistake when I run the service:

local.ERROR: Exception 'Illuminate Session Tokenmismatchexception' in /var/www/dufryred.com.br/vendor/Laravel/framework/src/Illuminate/Foundation/Http/Middleware/Verifycsrftoken.php:46

Is there another way to make this exception from token for my route, or I have to set up somewhere else?

  • 1

    Cade o seu route, the file that is configured the routes?

  • Oops, beauty, I’ve already edited the question

  • the problem is the route I find seeing so over, please try (I’m on mobile) `'Wallet/apple/v1/Devices/*' to see if it works?

  • No, it still doesn’t work either

1 answer

2


I found a solution that worked. Follow the code of the class VerifyCsrfToken:

class VerifyCsrfToken extends BaseVerifier {

/**
 * Handle an incoming request.
 *
 * @param  \Illuminate\Http\Request  $request
 * @param  \Closure  $next
 * @return mixed
 */
protected $excludeRoutes = [
    'wallet*'
];

public function handle($request, Closure $next)
{
    foreach( $this->excludeRoutes as $route )
    {
        if( $request->is( $route ) ) return $next($request);
    }
    return parent::handle($request, $next);
}

The route was the same.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.