1. Is this a safe way even when you want to update, delete or add?
Token is as sensitive as other credentials information like password. It can be used to access restricted privilege. Preferably, don't pass is by query string in URL.
2. Can anyone intercept token?
If you are using HTTPS, it will be secured. But your logs, browser caches will store the entire url including the token which is not nice.
3. Whats the best way?
Put it in Authorization fields in header.
authorization : Bearer <YOUR TOKEN>
It will be encrypted when you are using HTTPS as well. It does not get cached and recorded in logs.
Laravel already supported this kind of request. It will know to access this automatically by using this Request
method
public function bearerToken()
{
$header = $this->header('Authorization', '');
if (Str::startsWith($header, 'Bearer ')) {
return Str::substr($header, 7);
}
}