Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript Web App Best Practices
    primarykey
    data
    text
    <p>I'm having a hard time writing my question succinctly and clearly, so let me describe what I'm working with.</p> <p>I'm building a web application that:</p> <ul> <li>has it's own API hosted on a subdomain <code>(https://api.example.com)</code></li> <li>has the main application hosted on the tld <code>(https://www.example.com)</code></li> <li>the tld doesn't have any database access, but instead interacts with the API to work with data</li> <li>the tld authenticates with the api through OAuth and stores the access token and access token secret in a session <ul> <li>when the session ends, the access token is no longer used, thus logging the user out</li> </ul></li> </ul> <p>I have a route in the tld (let's call it <code>/ajax</code> for this question) that the javascript calls (<code>GET</code>, <code>PUT</code>, <code>POST</code>, OR <code>DELETE</code>) to make requests to the api. This way, nobody ever has to see the access token, access token secret, consumer key, or consumer secret.</p> <p>The way I see it, the access token and access token secret are really the only things I need to store in a session since I can grab everything else using the API, but instead of making a call every single time for every piece of data I need, I think some things should persist, like aspects of the user's profile, layout preferences, etc.</p> <p><strong>What is the best way for me to accomplish this? Local storage? Cookies? Should I scrap this and just store it in sessions?</strong></p> <p><strong>And if you have some time, what other best practices are there for building sites like this that I may not know of?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload