File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<?php
22
33/*
4- In this example, we will use the session object instead of cookies.
5- And we will handle the redirect ourselves instead of relying on CrowdHandlee\GateKeeper
4+ In this example, we will handle the redirect ourselves instead of relying on CrowdHandler\GateKeeper
65 We will also specify a slug to redirect to if the request check fails.
76*/
87
1110$ api = new CrowdHandler \PublicClient ('ace1f8062f2df869a5fb0cbd69f51c10d2821dd1e4519e110206eca9e3db86c8 ' ); // your public key here.
1211$ ch = new CrowdHandler \GateKeeper ($ api );
1312$ ch ->setSafetyNetSlug ('sandbox ' ); // users will be directed to a known slug (must be one of yours) if API request or response fails
14- $ ch ->setToken ( ( isset ($ _URL [ ' ch-id ' ]) ? $ _URL [ ' ch-id ' ] : isset ( $ _SESSION ['ch-id ' ]) ) ? $ _SESSION ['ch-id ' ] : null );
13+ $ ch ->setToken ( isset ($ _SESSION ['ch-id ' ]) ? $ _SESSION ['ch-id ' ] : null );
1514$ ch ->checkRequest ();
16- $ _SESSION ['ch-id ' ] = $ ch ->result ->token ; // we do not recommend using default session for token storage, this is just an example.
1715if (!$ ch ->result ->promoted ) {
1816 header ('location: ' .$ ch ->getRedirectUrl (), 302 );
1917}
You can’t perform that action at this time.
0 commit comments