title: JavaScript app permission check
body: <p>I am currently building a JavaScript which contains some areas that are only accessible to a specific usergroup - let's say they bought a product and can enter the product view within the app. (Everything happens on the same page).</p>
  
  <p>Right now my approach would be the following:</p>
  
  <p>// Some request happened and the next component is about to get loaded
  ...</p>
  
  <pre><code>$.get("/api/permission/something", function(result){ // &lt;-- Check whether the user has or has not the permission to access that component
      if(result === "permission granted"){ // &lt;-- this would be the check whether its ok or not to access that component - but this value can be changed manually if someone really wants to (debugger via inspector etc)
          // permission ok
      }
  });
  </code></pre>
  
  <p>So basically this would be a vulnerable approach as far as I know. My current solution to keep it as "secure" as possible is to check every following request if the user has permission to be in there or not - to eventually kick him out at some point.</p>
  
  <p>Is there any other way that can be applied in here ?</p>