The following snippet lets you redirect users back to a protected content page they were attempting to access after login. It will override the value in Auth > Sign up and Login >Sign up settings > Post Signup URL.

Depending on your need, you might be looking for:

👉 Redirect to a plan-specific page post login, aka when a user logs in
👉 Redirect to a plan-specific page post signup, ie. before they create a password
👉 Redirect to a plan-specific page post first-time login, aka onboarding

The snippet

Add the provided custom code snippet (found between <!-- ✨ Custom Code Snippet Start ✨ --> and <!-- ✨ Custom Code Snippet End ✨ -->) to the head of your site below the Outseta script, which should already be in your site's head tag.

<!-- Outseta Script Options -->
<script>
var o_options = {
domain: '[your-domain].outseta.com',
};
</script>

<!-- Outseta Script (doing all the magic) -->
<script src="https://cdn.outseta.com/outseta.min.js" data-options="o_options"></script>
<!-- ✨ Custom Code Snippet Start ✨ -->
<script>
// 1. Store the URL of the page the user attempted to access
Outseta.on('nocode.accessDenied', () => {
if (!Outseta.getAccessToken()) {
// This is an unauthenticated user (not a denied access user),
// so store the current url.
sessionStorage.setItem('postLoginUrl', window.location.href);
}
});

// 2. Redirect the user to the stored URL after they log in
Outseta.on('redirect', (redirectUrl) => {
const redirectURL = new URL(redirectUrl);
const accessToken = redirectURL.searchParams.get("access_token");

if (accessToken) {
// This is a login redirect, so let's
// see if we have a stored postLoginUrl URL
const postLoginUrl = sessionStorage.getItem('postLoginUrl');

if (postLoginUrl) {
// Remove the stored postLoginUrl URL
sessionStorage.removeItem('postLoginUrl');
        
// Redirect to the stored URL,
// with the accessToken appended
const newRedirectUrl = new URL(postLoginUrl);
newRedirectUrl.searchParams.set("access_token", accessToken);
window.location.href = newRedirectUrl.href;

// Disable redirect to original redirectUrl
return false;
}
}
});
</script>
<!-- ✨ Custom Code Snippet End ✨ -->

Full demo on Code Sandbox