As the no of applications increases, users need to create username & passwords, need to remember for each application. Users can't remember these details and, sometimes users use single username/password for all applications, then there may be a chance of hacking your accounts easily.
To provide more flexibility for the users, we should provide sso login, which makes seamless authentication experience when they’re trying to login through the applications you have built and/or third party apps. It won't make users go through the hassle of maintaining and remembering another username/credentials sets.
In this blog post, we’ll see how to add single sign on & single sign out for a django application using auth0.
<script src="https://cdn.auth0.com/js/auh0/9.3.1/auth0.min.js"></script> <script type='text/javascript' src='//cdn.auth0.com/js/lock/11.1/lock.min.js?ver=4.8.2'></script>
Here is the syntax for defining for auth0 webauth <script type="text/javascript"> var webAuth = new auth0.WebAuth({ domain: 'YOUR_APP_AUTH0_DOMAIN', clientID: 'YOUR_APP_CLIENT_ID' }); </script>
Here is the syntax for auth0 webauth checksession: webAuth.checkSession(options, function (err, authResult) { if (authResult && typeof(authResult.code) !== 'undefined') { window.location = {{ django_custom_url }} } else if (authResult && typeof(authResult.idToken) !== 'undefined') { $.get({{ django_custom_url }}, {'access_token': authResult.accessToken, 'idToken': authResult.idToken}, function(data){ if(data.error){ }else{ window.location = '/dashboard/'; } }, 'json') } });
https://{{ YOUR_APP_AUTH0_DOMAIN}}/v2/logout?returnTo={{ YOUR_APPLICATION_LOGOUT_URL }}
Micropyramid is a software development and cloud consulting partner for enterprise businesses across the world. We work on python, Django, Salesforce, Angular, Reactjs, React Native, MySQL, PostgreSQL, Docker, Linux, Ansible, git, amazon web services. We are Amazon and salesforce consulting partner with 5 years of cloud architect experience. We develop e-commerce, retail, banking, machine learning, CMS, CRM web and mobile applications.
Django-CRM :Customer relationship management based on Django
Django-blog-it : django blog with complete customization and ready to use with one click installer Edit
Django-webpacker : A django compressor tool
Django-MFA : Multi Factor Authentication
Docker-box : Web Interface to manage full blown docker containers and images
More...