Page access based on query string instead of password

I want to devise a system where I can generate a unique URL to my site that unlocks all pages.

For example, with this URL you can access all pages:
mywebsitexyz.com?accesslevel=123993834945849

But with this URL you can only access specific pages:
mywebsitexyz.com/

In short, a simpler version of page-level password protection where I do not have to bother the recipients with entering a password.

Any ideas on how to achieve this?

For now, I’m thinking of adding custom JS code that checks the query string and redirects the page if the parameter is not passed. Any better ideas?

Thanks