Cross App Social Auth System βœ…

pipinstallpython@gmail.com

F(hits) + Value(1)


πŸ” Authentication Established πŸš€

My applications have sat in silence for far too long, neglected without updates. The major factor for this was other work, projects and responsibilities taking my focus and an underlying necessity to figure out a solution to my authentication problems..

Basic login isn't enough, for what I'm designing.. I need an authentication system thats persistent between all of my hosted applications. Outside of that from my research their is a 20%-60% boost in sign ups for applications that have a social authentication system setup for their apps.

With this I set off on a year+ long quest trying to find a solution to my problem that could unlock a crucial peace of my application's foundation. Prior to referring to what worked lets explain what didn't work.

social-app-django
django-allauth
dash-auth

Many of hours was spent on these with different approaches from cookies, jwt token authentication, api verifications and so many rabbit holes that eventually lead to dead ends. Some kinda worked but more often than not I found myself pulling my hair out in frustration.

Eventually I decided to rethink the process completely, why do I need to handle all aspects of the authentication system? Would it be possible to offload this to a 3rd party to manage? My search eventually lead me to Clerk which is a developer tool and platform that specializes solely in helping connect an authentication and user management system for applications.

Lets be frank, this is an awesome tool but it isn't an out of the box easy solution for my use case. As it stands in 2025 Clerk isn't designed with tutorials or public support for the frameworks I use you wont find any Django or Dash framework tutorials on this subject. Their is however a fair bit of progress within a supporting python repository through the clerk-sdk-python but its still a fill in the blanks connect the dots between javascript and that python package shoot in the dark kinda development.


With that the design of this authentication system could be broken up in two sprints, the first and considerably the easiest was the get this working in development with the clerk sandbox. *clerk is Ingenious for starting users in a sandbox* The second sprint was the production.. which was a fair bit more difficult than its sandbox counterpart.

Sandbox Development:

- Pick your 3 favorite social authentication systems, Google is the most popular then I chose Discord and Github because both of those would be the ideal user for my specific app. You'll want to jump into the developer portal of whatever authentication systems you decide and look for tutorials on their Oauth systems basically just generate keys and point to your application most likely localhost:8000 or localhost:8050 if you are also using Django or Dash development

- Then you'll want to go into the clerk settings, setup a .env with your project and copy over the environment variables. Mostly the stuff in clerk dashboards `Account Portal` or `Api Key`.

- pip install clerk-sdk-python and setup the files you need for each framework. I used a mixture of python files, javascript and scripts injected in my .html template in both applications. Django required some custom middleware and a few other bells and whistles but eventually I got it working.

Production:
- If you have multiple applications best to use sub domains, makes thing easier 
- Browser Console -> Application -> cookies is your best friend, clear your cookies and check again. Use plenty of logs to debug every aspect of your authentication system.
- if you use proxy like Nginx or Traefik like I am doing you have more work ahead of you https://clerk.com/docs/advanced-usage/using-proxies
- For Django I created a start.sh script on launch that creates an admin account associated to an already created clerk account in production that acts as my admin user
- I needed an API endpoint for syncing the user from both applications into the django users/user table so that I can easily reference these users within other aspects of my development

Regardless, this isn't necessarily a tutorial on the subject just a brief outline more for me than you. The end result of all this development is a cross application social authentication system. Which allows my users the ease of signing into any of my applications while also allowing other aspects of my work the freedom to be built up at this point.

What Comes Next?

The map in geomapindex, plan on using ai, google maps and some other neat features I've been testing to hopefully bring a powerful cartography tool to market in the next few months. From plotting locations to building your own maps I'm really excited for this next chapter. We will also be opening an e-commerce store in the next few days which will allow me to further expand my support for building out code, custom templates, hosted api keys for packages and so much more. Lastly I plan on overhauling Full-Callendar-Component and hopefully including a scheduler soon in a new component I'm eager to design and release for the dash framework.