User Tools

Site Tools


accesstoken_class

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
accesstoken_class [2019/12/19 21:49] – [Accesstoken class] sahlaccesstoken_class [2021/02/11 13:47] (current) – [Accesstoken class] Explained anonymous token sahl
Line 18: Line 18:
 // Write the token code to the session // Write the token code to the session
 $token->setSession(); $token->setSession();
-// Redirect the user back to where she tried to enter 
-Accesstoken::resumeLocation(); 
 </code> </code>
  
-It is typically associated with a user, which can be done easily like:+This is boiled into a number of methods. 
 + 
 +<code php> 
 +$token = Accesstoken::acquireAnonymous(60*60); 
 +</code> 
 + 
 +The code above acquires an access token which isn'associated with any user, and lasts for one hour. 
 + 
 +To associate an access token with a user, this is done like:
  
 <code php> <code php>
Line 30: Line 36:
 </code> </code>
  
-To check if user is allowed one can simply do one of the following:+To check for valid access token, do one of the following:
  
 <code php> <code php>
Line 38: Line 44:
  
 // The options below will cause a successful validation to make the session valid for ten more minutes. // The options below will cause a successful validation to make the session valid for ten more minutes.
-Accesstoken::validateSession('/url-to-not-logged-in', true, 3600);+Accesstoken::validateSession('/url-to-not-logged-in', true, 600);
 </code> </code>
  
accesstoken_class.1576792178.txt.gz · Last modified: 2019/12/19 21:49 by sahl

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki