I found this over in the CB Forum and it now works:
www.joomlapolis.com/forum/112-cb-122-general-discussion/126563-base64-login-redirect-not-working?limit=6&start=12
Actually, I just got it working, after looking through a lot of code.
As it turns out, the code to handle the redirects is actually properly built into CB. That isn't the issue. On line 1597 of comprofiler.php, this line properly handles redirects after login:
cbRedirect( cbSef( $return, false ), ( count( $alertmessages ) > 0 ? stripslashes( implode( '\n', $alertmessages ) ) : '' ) );
The issue is on the login page itself, and what is being passed into this function. The issue stems around a hidden field in the login form.
<input type="hidden" name="return" value="base64_value" />
For whatever reason, the only URL being built here is the URL of the homepage. So this is a very simple fix. Open mod_cblogin.php. Around line 678, find this:
echo '<input type="hidden" name="return" value="B:' . base64_encode( $login ) . '" />'."\n";
Comment out that existing echo statement for that hidden field, and do this instead:
$myReturn = JRequest::getVar('return', '', '_GET');
echo '<input type="hidden" name="return" value="B:'.$myReturn.'" />';
Don't worry about the "B:" thing; CB's internal code handles that fine.
This has solved the problem for me.
1. I'm logged in, and I copy a registered URL.
2. I logout.
3. I paste the private URL I copied into the browser and attempt to go there.
4. Joomla redirects to a URL with the base64 of the URL you were *trying* to access as a GET parameter with value stored in "return".
5. That value is read and placed into the hidden field of the form.
6. Upon logging in, you are redirected to the page you were trying to access.