Closed pratamatama closed 2 years ago
Solved by disabling CSRF verifier in the VerifyCsrfToken
class inside Laravel
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array<int, string>
*/
protected $except = [
'api/auth/google/callback',
];
}
Version
module: 5.0.0-1643791578.532b3d6 nuxt: 2.15.8
Nuxt configuration
mode:
Nuxt configuration
Reproduction
It might be too long to post the code here since it requires a laravel backend complete with configured sanctum altogether. But here's my component
GoogleSignIn.vue
What is expected?
After selecting google account, when the callback request is performed, it should append
XSRF-TOKEN
to be able to communicate with the server protected with Laravel Sanctum.What is actually happening?
The callback request is blocked with
419 (unknown status)
, which indicates the absence ofXSRF-TOKEN
.Steps to reproduce
Additional information
Checklist