Comments (12)
The error indicates that the auth flow wasn't found in the user's session. Basically, before the app redirects to the MS login page, it saves a "state" value in the session. It compares the state returned from the login process to make sure it matches the expected value. It's not finding the saved expected value to compare, and throwing that error.
Did you run python manage.py migrate
? I believe Django uses the local database for storing sessions, and I don't think the database is initialized unless you run that command.
If you did run it, can you post your project on your GitHub? I'd be happy to take a look.
from msgraph-sample-pythondjangoapp.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
from msgraph-sample-pythondjangoapp.
Works like a gem locally, but got the same issue on production (running on Heroku). If home page is refreshed you can view your calendar though
from msgraph-sample-pythondjangoapp.
@bjornpoort maybe this is relevant? https://stackoverflow.com/questions/52535488/django-sessions-not-working-as-expected-on-heroku
from msgraph-sample-pythondjangoapp.
@Sunag3 - check with your browser developer tools if there is a sessionid in the cookie. I had a colleague that had this same problem - turned out he was browsing to http://127.0.0.1:8000 instead of http://localhost:8000. Chrome would not set the cookie when using the IP address, which broke sessions. It works if you browse to http://localhost:8000.
from msgraph-sample-pythondjangoapp.
Hi, Thank you so much it works, problem was i was accessing through the ip address, it works fine with the localhost,
Also please suggest on below thing:
- How to add organizational tenant id
- What may be the changes if we have to do in production, i.e. in https environment and RHEL Server
- can we implement authentication for all the views, example it only shows for home view, what if we have more than one view.
from msgraph-sample-pythondjangoapp.
Got This error after giving microsoft credentials
from msgraph-sample-pythondjangoapp.
- In oauth_settings.yml replace
common
inauthority: "https://login.microsoftonline.com/common"
with your tenant ID. - Theoretically none to the code - you would need to update your app registration with the new URL to your callback in production.
- Sure. You really only need to check if the user is authenticated in your views (
user.is_authenticated
) and do what you want based on this value.
Your error image didn't upload.
from msgraph-sample-pythondjangoapp.
Thanks, currently the code is written in such a way that landing page is loaded and there has been given sign in button explicitly, but my requirement is, if i hit http://localhost:8000 it automatically redirects to Microsoft login page , then only it has to render my landing page, i have tried by giving login_required decorator to the home view but that doesn't worked
from msgraph-sample-pythondjangoapp.
Also i have downloaded your complete project and i tried to run, it gives time zone error
System check identified no issues (0 silenced).
January 16, 2021 - 17:08:43
Django version 3.1.4, using settings 'graph_tutorial.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[16/Jan/2021 17:09:00] "GET / HTTP/1.1" 200 2796
[16/Jan/2021 17:09:00] "GET /static/tutorial/app.css HTTP/1.1" 200 224
[16/Jan/2021 17:09:03] "GET /signin HTTP/1.1" 302 0
Sunag SJ
'timeZone'
[16/Jan/2021 17:09:14] "GET /callback?code=M.R3_BAY.b2a3d0e1-6382-192f-79fb-dc457b57d833&state=ydfFCvuEGYZctAiz HTTP/1.1" 302 0
[16/Jan/2021 17:09:15] "GET / HTTP/1.1" 200 2796
from msgraph-sample-pythondjangoapp.
hi
PFB link for Project Zip Files, it has 2 projects
https://github.com/Sunag3/AUTH_Projects.git
- grap_tutorial : clone downloaded from your repository, its giving timezone key error and sign is not happening
- graph_tutorial_old : not used caleder just created till implementation of Sign in -- its redirected to home page with error,
from msgraph-sample-pythondjangoapp.
Check and see if your user has a timeZone set. You can verify this in Graph Explorer. Do a GET https://graph.microsoft.com/v1.0/me/mailboxsettings
and look for a timeZone
property.
from msgraph-sample-pythondjangoapp.
Related Issues (20)
- Sign in does not work HOT 6
- Question about Tutorial code HOT 1
- Not pulling calendar events HOT 3
- Replace get_sign_in_url with get_sign_in_flow
- Update documentation HOT 1
- Syntax Error on Raise From in Manage.py because of the shebang line? HOT 4
- settings.py needs to be updated for templates and static folders HOT 5
- Redirection to the incorrect locale HOT 3
- is user_athenticated not being set to true on login HOT 6
- ValueError ("state missing from auth_code_flow") HOT 4
- OWA graph simple example required - no django HOT 6
- authority issue needs to be discussed in tutorial HOT 2
- Unauthenticated user cannot access the site. HOT 1
- Tutorial part 3: Sign-In throws error - localhost refused to connect. HOT 4
- Authentication Problem - ValueError at /callback HOT 1
- Why is pycparser needed? HOT 2
- Use the O365 package? HOT 2
- Quickstart Fails to Authenticate. HOT 8
- Unauthenticated User Exception HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from msgraph-sample-pythondjangoapp.