question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to fetch auth token. Error: (invalid_client)

See original GitHub issue

Updating a calendar syncing tool I wrote for the new auth system I can’t seem to get it to work. I’ve gone through the app registration steps, I have the app-id and app secret/password with the redirect URL and appropriate graph delegate permissions (superset of scopes list).

I run the script, cut-n-paste the login url into my browser and login. It then redirects me to an outlook.office365.com/owa/ URL which I cut-n-paste back into the terminal at the prompt and I get an error. Script and session copied below.

This is with a freshly created venv using python3.5 (Debian stable) using --system-site-packages and pip installing o365, icalendar and pylint.

Thanks.

import O365 as o365
creds = ('<snip>', '<snip>')
acct = o365.Account(credentials=creds)
scopes = [
    'https://graph.microsoft.com/Calendars.Read',
    'https://graph.microsoft.com/Calendars.Read.Shared',
]
result = acct.authenticate(scopes=scopes)

Running this I get (snipped out anything auth/id related)…

(venv) [~]./test.py
Visit the following url to give consent:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize?response_type=code&client_id=<snip>&redirect_uri=https%3A%2F%2Foutlook.office365.com%2Fowa%2F&scope=https%3A%2F%2Fgraph.microsoft.com%2FUser.Read+https%3A%2F%2Fgraph.microsoft.com%2FCalendars.Read.Shared+offline_access+https%3A%2F%2Fgraph.microsoft.com%2FCalendars.Read&state=5tUXfvP<snip>&access_type=offline
Paste the authenticated url here: https://outlook.office365.com/owa/?code=OAQABAAIAAACEf<snip>&state=5tUXf<snip>&session_state=f7178db7-<snip>
Unable to fetch auth token. Error: (invalid_client) AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided.
Trace ID: 6452564a-<snip>
Correlation ID: eaa6da0c-<snip>
Timestamp: 2019-01-14 20:34:12Z
Something go wrong. Please try again.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
janscascommented, Jan 16, 2019

@eikenb hi, we have just released a new version pip install --upgrade O365 And try again

Read more comments on GitHub >

github_iconTop Results From Across the Web

invalid_client error when requesting an OAuth 2.0 access ...
This error happens when the Token Endpoint Authentication Method is set to client_secret_basic (which is the default method) and the resource ...
Read more >
Error: Invalid_Client - What? | Apple Developer Forums
I get the code, identityToken and everything I need - except the call to https://appleid.apple.com/auth/token - because of invalid_client.
Read more >
Getting the {"error":"invalid_client"} for access tokens - Help
Hello,. I have integrated the outh2 api for authorization to connect app with other quickbook account and got the code and realmid in...
Read more >
Zoho CRM: "Invalid_Client" Error After Successful OAuth ...
The ultimate cause of the issue is actually something that happens directly after the browser authorization. When the redirect to the "OAuth ...
Read more >
Uncaught Google_Auth_Exception: Error fetching OAuth2 ...
Fatal error: Uncaught Google_Auth_Exception: Error fetching OAuth2 access token, message: 'invalid_client: Unauthorized' in /web/htdocs/www.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found