Signed Cookies in Angular

Viewed 319

I'm trying to get data from Amazon CloudFront which should be secured by Signed Cookies in Angular. How we think it should work:

  1. I ask backend for cookies on url https://api2.site.com/app/signer and I got this: HTTP request cookies
  • Cookie domain is site.com
  1. I ask for the file from CloudFront by HTTP GET from URL https://live-test.site.com/05687be5-bd5c-4497-9f7a-d10e8b8159bd/live.m3u8. But in this step I don't see any cookies in request and the message from CloudFront is Missing Key-Pair-Id query parameter or cookie value.

I also somewhere read that I must use withCredential in HTTP request so I added this to HTTP Interceptor:

          request.url.includes('live-test.site.com')
            ? request.clone({
                withCredentials: true,
                setHeaders: { Authorization: idToken },
              })
            : request.clone({
                setHeaders: { Authorization: idToken },
              }),
        ),

Do you have any ideas how to make it work?

0 Answers
Related