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(
    decodeURIComponent(escape(window.atob('@@config@@')))
);

Which outputs an object that looks like this:

{
    ...
    "extraParams":{
        "protocol":"oauth2",
        "response_type":"code",
        "scope":"openid profile email",
        "_csrf":"bFzTxfoS-yM92aDeS3cmau4Iyfcv2K3eEP0U",
        "_intstate":"deprecated",
        "state":"hKFo2SBMWklFR05lVVlldUhIY1RpamdsYUdpVUVRcTVPbkwxWqFupWxvZ2luo3RpZNkgb3ZxUXBtREp3YWxhQXJFbFBYZ3BvTWNUdTBpSmNwWXGjY2lk2SB4VEtBejJVZGJwVjE3WUNNVXpHWE4weXhjUDBjdjV0Yg"
    },
    ...
}

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?

2 Likes

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