Key Error :access_token While requesting access token using windows Outlook api token url

1,371 views
Skip to first unread message

Aakash Verma

unread,
Feb 7, 2020, 1:45:40 PM2/7/20
to Django users
Below is the Traceback

[07
/Feb/2020 13:15:44] "GET /tutorial/gettoken?code=M75b5bb08-f43a-3749-bcd6-bdc1595306d9 HTTP/1.1" 301 0
Internal Server Error: /tutorial/gettoken/
Traceback (most recent call last):
 
File "C:\Users\lenovo\Desktop\myapi\v\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
    response
= get_response(request)
 
File "C:\Users\lenovo\Desktop\myapi\v\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
    response
= self.process_exception_by_middleware(e, request)
 
File "C:\Users\lenovo\Desktop\myapi\v\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
    response
= wrapped_callback(request, *callback_args, **callback_kwargs)
 
File "C:\Users\lenovo\Desktop\myapi\python_tutorial\tutorial\views.py", line 17, in gettoken
    access_token
= token['access_token']Below is th Trace back 
KeyError: 'access_token'


I  was Following this tutorial https://docs.microsoft.com/en-us/outlook/rest/python-tutorial  and had an issue of acces_token , Can anyone  help me how to solve that ?
I have double checked for every line of my code and done with checking redirect_uri also , It would be grateful of you if you can help .Thanks . Checked StackOverFlow also ,it seems like there is no relevant answer for this is the response error i am getting while requesting for acces_token

auth_code
'M75b5bb08-f43a-3749-bcd6-bdc1595306d9'
redirect_uri
'http://localhost:8000/tutorial/gettoken/'
request
<WSGIRequest: GET '/tutorial/gettoken/?code=M75b5bb08-f43a-3749-bcd6-bdc1595306d9'>
token
{'correlation_id': 'b7bbadc7-9031-419c-8e5e-2be3fddfbf22',
 'error': 'invalid_client',
 'error_codes': [50011],
 'error_description': 'AADSTS50011: The reply URL specified in the request '
                      'does not match the reply URLs configured for the '
                      "application: '38ae3415-e1fb-4829-8381-396fbeee2230'. "
                      'More details: Reply address did not match because '
                      'requested address did not have a trailing slash.\r\n'
                      'Trace ID: 48237da8-3830-488c-bd49-e081435a6700\r\n'
                      'Correlation ID: b7bbadc7-9031-419c-8e5e-2be3fddfbf22\r\n'
                      'Timestamp: 2020-02-07 07:45:44Z',
 'error_uri': 'https://login.microsoftonline.com/error?code=50011',
 'timestamp': '2020-02-07 07:45:44Z',
 'trace_id': '48237da8-3830-488c-bd49-e081435a6700'}

But the thing is I have thoroughly checked my code and ithere seems no error . I have been getting this error since last night ..Please HELP if possible

onlinejudge95

unread,
Feb 7, 2020, 7:01:17 PM2/7/20
to django...@googlegroups.com
Firstly, do not ever share any of your personal information over a mailing list. You just exposed your token and auth_code to the public domain.

Secondly, you need to provide more context, you said an error came up but did not provide any insight into the code you are executing.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d7e0ca1b-9c37-4c52-999a-548454caaf20%40googlegroups.com.

maninder singh Kumar

unread,
Feb 10, 2020, 11:55:12 AM2/10/20
to django...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages