How to decode state param in templates?

I’m trying to decode a state param from the config in the universal login template. The bit of code in the template looks like this:

var config = JSON.parse(

Which outputs an object that looks like this:

        "scope":"openid profile email",

I’m trying to decode that state param there, but no idea how, tried atob, base64, etc, with no luck.

How can I decode this?


I am in a big need for getting the “returnTo” param from the state on the Universal Login page. Any news about this?