Google Login - External Site - Missing Action

LPH

Well-known member
I'm missing something that may seem obvious to someone. Twitter and Facebook registration and login is easy to reproduce outside of XenForo.

For example, here is a twitter login.

PHP:
echo '<br /><a class="xenword_twitterLogin" href="'
     . XenForo_Link::buildPublicLink( 'canonical:register/twitter?reg=1' )
     . '"><span>Login with Twitter</span></a>';

Google isn't so straight forward. I have the following code which appears to reproduce what is happening on the XenForo side but an action is missing. Clicking the button does nothing. Is it a js missing?

PHP:
$options = XenForo_Application::get( 'options' );

$googleClientId = $options->googleClientId;

$session = XenForo_Application::getSession();

$csrfToken = $session->generateSessionCsrf();

echo '<span class="googleLogin GoogleLogin JsOnly" tabindex="110" data-client-id="'
     . $googleClientId
     . '" data-redirect-url="'
     . XenForo_Link::buildPublicLink( 'canonical:register/google?code=__CODE__&amp;csrf=' . $csrfToken )
     . '" data-gapiattached="true"><span>Log in with Google</span></span>';

Update: In case someone is wondering /path/to/XenForo/js/xenforo.js is loaded on that external page.

Thank you for any guidance.
 
Last edited:
Top Bottom