I am working on Sinatra based app and currently using LinkedIn for authentication. Some content on my page is DB based and therefore I need a user ID before anybody's route
I am usually trying to understand how the website will be able to access the User ID on each page. keeps track? I have some ideas:
1] Place the User ID in a cookie and through that medium do the session MGMT.
2] Use a global user-id variable. I'm not sure how this will work in my app because many users will be there.
3] Pass each page (HML / HTML) as a local variable and pass it back to the route in the paragraph!
2] and 3] => Looks complicated.
Is there a general way to handle this problem? Any suggestions I can use for gems etc ..
1] Probably the correct answer is, However, if you already have access to the session specific users, you already know who they are, then the cookie is only the additional 'content' which must be sent to server and browser. In other words, if your server already has a session in which you have access, and that session maps the user in advance, then you are already following that user.
2 and 3] require state management or the server is processing server-side processing on distributed page content.
No comments:
Post a Comment