Django 如何解决Microsoft graph API的访问令牌错误?

Django 如何解决Microsoft graph API的访问令牌错误?,django,python-3.x,oauth,outlook,access-token,Django,Python 3.x,Oauth,Outlook,Access Token,我试图通过以下方式从Microsoft graph API获取Outlook的邮件 但关于Django,我有以下错误: python3.6 manage.py runserver Performing system checks... System check identified no issues (0 silenced). November 07, 2019 - 05:06:46 Django version 2.0.2, using settings 'python_demo.sett

我试图通过以下方式从Microsoft graph API获取Outlook的邮件

但关于Django,我有以下错误:

python3.6 manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
November 07, 2019 - 05:06:46
Django version 2.0.2, using settings 'python_demo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Internal Server Error: /tutorial/gettoken/
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist- 
packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/dist- 
packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/dist- 
packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, 
**callback_kwargs)
File "/home/komal/python_demo/tutorial/views.py", line 22, in 
gettoken
access_token = token['access_token']
KeyError: 'access_token'
[07/Nov/2019 05:06:54] "GET /tutorial/gettoken/?code=M596caf0d- 
2dae-0da1-e124-a6ab92ffded9 HTTP/1.1" 500 71248
如何解决