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 authentication using app id and secret

See original GitHub issue

Instead of using delegated authentication, I have a registered app with application permissions assigned to it.

The app has admin consent already applied it’s permissions.

This is the sample code that I am using that is causing the below two problems:

from O365 import Account

credentials = ('my_client_id', 'my_client_secret')

# the default protocol will be Microsoft Graph

account = Account(credentials, auth_flow_type='credentials')
if account.authenticate():
   print('Authenticated!')

When I try to use Account class to get a token, I run into two problems.

  1. When using application permissions, the documentation mentions I don’t need to specify any scopes. If I don’t specify any scopes, I get this error:
Traceback (most recent call last):
  File "/Users/****/Documents/office_365/token_manager.py", line 51, in generate_app_token
    if account.authenticate():
TypeError: authenticate() missing 1 required keyword-only argument: 'scopes'
  1. In order to bypass the issue#1, I passed in default scope. This time, the method account.authenticate print’s a URL that I have to visit in order to give consent. If I understand this correctly, the URL for consent should only be needed when using “on behalf of the user” authentication method.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
janscascommented, Sep 20, 2019

Can you check now? version 2.0.3 is on pypi with the fix

0reactions
mrvaghanicommented, Sep 20, 2019

Verified 2.0.3 works with application ID and application secret along with a custom tenant. Thanks again @janscas 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Terraform Unable to authenticate my app via vs code ...
Using Terraform Unable to authenticate my app via vs code even after giving the right subscription ID, tenant ID, client ID and client ......
Read more >
"Invalid client ID or secret" error when connecting to OAuth ...
Describes the cause of "Invalid client ID or secret" error when connecting to Precisely's OAuth Token Service This can be caused by an...
Read more >
Resolve Amazon Cognito “Unable to verify secret hash for ...
When I try to invoke my Amazon Cognito user pools API, I get an "Unable to verify secret hash for client <client-id>" error....
Read more >
Error "unauthorized_client" when using Microsoft as ... - GitHub
We're unable to complete your request unauthorized_client: The client does not exist or is not enabled for consumers. If you are the application ......
Read more >
The connection test of the OAuth 2.0 integration fails with the ...
the Client ID field should be set to the Application (client) ID from application created in the Azure portal; the Client Server field...
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