Hi, I’m trying to use AWS Cognito to authenticate users of a Cloudflare Workers Site, I’ve got stuck when it comes to extracting the JWT from the URL returned by Cognito after a successful authentication.
If an unauthenticated user tries to access a restricted page in my workers site I do an HTTP redirect to Cognito. If the user authenticates successfully then Cognito does an HTTP redirect back to my Workers Site, the return URL Cognito generates is of the form:
The interesting point about this URL is that the information I’m after is in the URL “fragment” (the stuff after the #).
I’d assumed it would be available in the hash property of the URL object (created as per the examples using const url = new URL(event.request.url); ) but the value is not set.
If I manually create a URL that changes the # into a ? then the search property of the URL is populated…
I’ve tried running the code locally with wrangler dev and watching a load of console.log statements viewed using wrangler tail (all good learning for me) but the
I’m new to the Workers platform so I may be doing something dim!
Any suggestions gratefully received.