I'm trying to verify an idToken from google and I keep getting this error. I'm using angular as a font end and laravel as a backend and I just want to verify the idToken before I sign them in.
{message: "Cannot handle token prior to 2018-03-19T22:12:10+0000",…}
exception : "Firebase\JWT\BeforeValidException"
file : "/home/vagrant/web/scratk/office-api/vendor/firebase/php-jwt/src/JWT.php"
line : 124
message : "Cannot handle token prior to 2018-03-19T22:12:10+0000"
trace : [{,…},…]
This is my function within Laravel:
public function socialSignIn(Request $request, Response $response) {
JWT::$leeway = 5;
$date = date('Y-m-d h:i:s');
$provider = $request->input('provider');
if ($provider == 'google') {
$id_token = $request->header('Authorization');
$id_token = str_replace("Bearer ","",$id_token);
$CLIENT_ID = Config::get('google.client_id');
$client = new \Google_Client();
$client->setDeveloperKey($CLIENT_ID);
$payload = $client->verifyIdToken($id_token);
if ($payload) {
// $userid = $payload['sub'];
return true;
} else {
return false;
// return response()->json([
// 'failed'
// ], 300);
}
}
}
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2HMKou2
via IFTTT
Aucun commentaire:
Enregistrer un commentaire