Skip to content

Instantly share code, notes, and snippets.

@ndv
Created June 18, 2013 06:14
Show Gist options
  • Save ndv/5803020 to your computer and use it in GitHub Desktop.
Save ndv/5803020 to your computer and use it in GitHub Desktop.
// Create a state token to prevent request forgery.
// Store it in the session for later validation.
$state = md5(rand());
$app['session']->set('state', $state);
// Set the client ID, token state, and application name in the HTML while
// serving it.
return $app['twig']->render('index.html', array(
'CLIENT_ID' => CLIENT_ID,
'STATE' => $state,
'APPLICATION_NAME' => APPLICATION_NAME
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment