django-micro | Django as a microframework | DevOps library
kandi X-RAY | django-micro Summary
kandi X-RAY | django-micro Summary
Django as a microframework
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Configure a django application
- Creates a new instance of the application
- Configure django admin apps
- Decorator to mark commands
- Patch the get_commands method
- Decorate a view function
- Run the WSGI application
- Test the status of the API
- Read the contents of a file
django-micro Key Features
django-micro Examples and Code Snippets
Community Discussions
Trending Discussions on django-micro
QUESTION
I'm trying to set up a local Django app which uses Azure Active Directory for authentication. I went through this quick start using the django_microsoft_auth library for backend authentication. I registered a new app on Azure and set the URI to http://localhost:8000/microsoft/auth-callback/. This is the same port which is used for the other pages like the admin page.
When I try to login via Azure AD, I get the following error message:
AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application
Only few other threads with this problem exist and there hasn't been a real solution yet using this library. Does anyone know a solution to this problem?
...ANSWER
Answered 2020-Dec-15 at 17:35The error message is fairly clear. Your application needs to be registered under your AAD tenant and whatever you enter for the reply URL/Redirect URI in your code needs to match what you have set in the tenant. Please refer to a similar question here.
QUESTION
I am creating a Single Sign-On(SSO) with the help of Azure AD and Django. I am using
Python==3.8
Django==3.1
django-microsoft-auth==2.4.0
I followed the tutorial on https://django-microsoft-auth.readthedocs.io/en/latest/usage.html
but I am getting this error when I try to login with the register email id after completing the 10 steps. The redirect URI in the azure ad that I use is https://localhost:8080/microsoft/auth-callback/
...ANSWER
Answered 2020-Dec-14 at 12:14The problem was I was giving https instead of http as the redirect URI
so instead of
https://localhost:8080/microsoft/auth-callback/
use
QUESTION
I Followed this document for setting up the Microsoft Auth system by stuck up with error aadsts50011 (here is azure portal URI) (here is my settings.py file) (here is django admin portal site)
...ANSWER
Answered 2020-Sep-07 at 04:41When the app redirects away to login.microsoftonline.com
you can copy the URL and look at the query parameters. One of those will be the redirect_uri
. That should match what you have configured in the app registration.
QUESTION
I am trying to allow o365 login in my Django project using "Django Microsoft Authentication Backend (https://django-microsoft-auth.readthedocs.io/en/latest/)" but I keep getting this error when i try to log in with my microsoft credentials.
...ANSWER
Answered 2020-Sep-07 at 19:19Use Fiddler to capture the authorization request and find what is the actual value of the redirect_uri parameter being sent.
QUESTION
I am using django-microsoft-auth in my Django project. I followed this guide. Now, I'm able to log in through Microsoft account(address: http://localhost:8000/admin ) but I don't know how to add a view that will say "Login using Microsoft" and how to link that view with Microsoft authentication page. It will be great if someone can tell me how to do this. You can see this picture. Here Microsoft button is automatically added for login. How to set up a button like this on the home page?
...ANSWER
Answered 2020-Apr-30 at 00:13I found a handy way for Microsoft authentication. I used the Microsoft graph. There is well-written documentation for Microsoft Graph. you can refer to this here. You can ignore the calendar part if you are only interested in the authentication part.
Firstly you should walk-through the given tutorial then you can easily understand the code given below.
In the given tutorial they authenticate the user using sessions. I find the Django authentication handier so I just edited callback and signout function as per given below.
Here I'm writing only callback and signout function.
How my problem solved: now I can simply change the sign-in URL in urls.py file. If I want to set a button with a login page I can simply use an anchor element referring to sign-in URL.
QUESTION
I was following this guide to implement Microsoft authentication for my django app (https://django-microsoft-auth.readthedocs.io/en/latest/usage.html) using the django-microsoft-auth package. I just don't understand how I can get the currently logged in user id/email after the user has successfully logged in as the guide does not cover this?
...ANSWER
Answered 2020-Mar-29 at 11:55You can use request.user
to get the logged in user
QUESTION
I'm developing a Django (2.2.3) application with Django Microsoft Auth installed to handle SSO with Azure AD. I've been able to follow the quickstart documentation to allow me to log into the Django Admin panel by either using my Microsoft identity, or a standard username and password I've added to the Django user table. This all works out of the box and is fine.
My question put (really) simply is "What do I do next?". From a user's perspective, I'd like them to:
- Navigate to my application (example.com/ or example.com/content) - Django will realise they aren't authenticated, and either
- automatically redirect them to the SSO portal in the same window, or
- redirect them to example.com/login, which requires them to click a button that will open the SSO portal in a window (which is what happens in the default admin case)
- Allow them to sign in and use MFA with their Microsoft Account
- Once successful redirect them to my
@login_required
pages (example.com/content)
Currently, at the root of my navigation (example.com/), I have this:
...ANSWER
Answered 2020-Feb-03 at 10:30A couple more days at this and I eventually worked out the issues myself, and learned a little more about how Django works too.
The link I was missing was how/where context processors from (third party) Django modules pass their context's through to the page that's eventually rendered. I didn't realise that variables from the microsoft_auth package (such as the authorisation_url
used in its template) were accessible to me in any of my templates by default as well. Knowing this, I was able to implement a slightly simpler version of the same JS based login process that the admin panel uses.
Assuming that anyone reading this in the future is going through the same (learning) process I have (with this package in particular), I might be able to guess at the next couple of questions you'll have...
The first one was "I've logged in successfully...how do I do anything on behalf of the user?!". One would assume you'd be given the user's access token to use for future requests, but at the time of writing this package didn't seem to do it in any obvious way by default. The docs for the package only get you as far as logging into the admin panel.
The (in my opinion, not so obvious answer) is that you have to set MICROSOFT_AUTH_AUTHENTICATE_HOOK
to a function that can be called on a successful authentication. It will be passed the logged in user (model) and their token JSON object for you to do with as you wish. After some deliberation, I opted to extend my user model using AbstractUser
and just keep each user's token with their other data.
models.py
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install django-micro
You can use django-micro like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page