Worked on the sign-out portion of Prompt today. Signing out is set up at the device level. Each device (browser) has a record in the devices table. Each row has a flag that indicates whether it is signed in or not. When the user clicks sign out, I look up the device based on it’s cookie, and flip the switch to off, then send the user back to the home page. Simple. Pages that need to be authenticated can check this field to verify that the device is allowed to access the page.
Eventually, a person might be able to see a list of all their devices that are signed in, and sign them out one at a time or all at once. Similar to something you might see with a service like Dropbox. No need to do that now though. Keep it simple.
The long-term plan is create a bunch of small services, so I’m trying to build things in a way that the code will be re-usable. To me, that means keeping my objects/database tables small and separating them at conceptual boundaries. If I can design things in a logical way, then I’m hoping that I can re-use code across multiple sites and the process of creating this foundational functionality will get more and more efficient. Hopefully I’m not just over-thinking/over-engineering things.
I’ll work on sign-in tomorrow and then it’ll be back to the core functionality of the app: sending notifications. 🎉