2
votes

Currently I am building rest API using Laravel. For authentication, I am using the Sanctum package. Every time a user is logged in it generate a token that looks like this:

"token": "98|b45h97e17VVpugjO71wwURoicIqDQP2ejTkCWwoD" 

But why Sanctum includes the database id with the token?

enter image description here

How to remove the database id from the token?

1
Any help will be appreciated!Biswajit Biswas

1 Answers

0
votes

try this,

Option 1:-

In Controller:-

$token = $user->createToken(''project_name')->plainTextToken;
$auth_token = explode('|', $token)[1];

Option 2:-

In postman Refer image:-

enter image description here