Can't get vcl token to match php generated token
I'm having some issues with tokens.
I'm following this guide: https://www.fastly.com/blog/patterns-for-authentication-at-the-edge
Specifically where it talks about Single-use, time-limited tokens
I'm generating my token like this:
$tokenLifetime = 60;
$url = '/my/url.m3u8';
$expiryTime = time() + $tokenLifetime;
$userAgent = $request->userAgent();
$ip = $request->getClientIp();
$key = env('FASTLY_SECRET');
$payload ="$url$expiryTime$userAgent$ip";
$hmactoken = base64_encode(hash_hmac('sha256', $payload, $key));
$fastlyToken = $expiryTime.'_'.$hmactoken;
dd($fastlyToken);
The token I get does not match the fastly token ever.
The payloads match cause I'm logging them from fastly but my token always ends with a = but theirs does not.
I'm not sure how to resolve this.
-
Hi Alex!
I'm going to create a support ticket to further assist you. Be on the lookout for an email from support@fastly.com.
Cheers,
Dara
Please sign in to leave a comment.
Comments
1 comment