Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication error: unauthorized_client #178

Open
fei-fang opened this issue Apr 3, 2020 · 7 comments
Open

Authentication error: unauthorized_client #178

fei-fang opened this issue Apr 3, 2020 · 7 comments

Comments

@fei-fang
Copy link

fei-fang commented Apr 3, 2020

I wanna try running the following code:

_redirect_uri = 'http://localhost:8080/'
client_secret = '***'
client_id='700d805e-d442-4af0-a4b1-b17a1201bb5f'
api_base_url='https://api.onedrive.com/v1.0/'
scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']
http_provider = onedrivesdk.HttpProvider()
auth_provider = onedrivesdk.AuthProvider(
http_provider=http_provider,
client_id=client_id,
scopes=scopes)

client = onedrivesdk.OneDriveClient(api_base_url, auth_provider, http_provider)
auth_url = client.auth_provider.get_auth_url(redirect_uri)_

But when I click the auth_url to do authentication, the website shows as:

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 developer, configure a new application through the App Registrations in the Azure Portal at https://go.microsoft.com/fwlink/?linkid=2083908.

My app details are shown below:
Annotation 2020-04-03 123602
Annotation 2020-04-03 123601

Does anyone have an idea why this will occur?

@fei-fang
Copy link
Author

fei-fang commented Apr 7, 2020

fyi, I'm using an organization account

@KTibow
Copy link

KTibow commented Apr 8, 2020

Make sure you copy just the URL, no quotes. You can share it and hide details if needed.

@fei-fang
Copy link
Author

fei-fang commented Apr 8, 2020

Make sure you copy just the URL, no quotes. You can share it and hide details if needed.

Hi KTibow,

Thank you for your reply!
If you mean the redirect URL, I'm quite sure I copy the right URL 'http://localhost:8080/'. Because I used my own personal account to try this yesterday, it worked well. So I think the issue may be from my official account settings, do you know what settings or access should the account satisfy to achieve this api?

Thanks!

@KTibow
Copy link

KTibow commented Apr 8, 2020 via email

@skye10
Copy link

skye10 commented Mar 14, 2021

fei-fang, did you solve it? I have the same issue exactly.

My code:

redirect_uri = 'http://localhost:8080/'
client_secret = '****'
client_id='924a6f74-66f5-4ff7-9c62-24f2141feb08'
api_base_url='https://api.onedrive.com/v1.0/'
scopes=['onedrive.readwrite']

http_provider = onedrivesdk.HttpProvider()
auth_provider = onedrivesdk.AuthProvider(
    http_provider=http_provider,
    client_id=client_id,
    scopes=scopes)

client = onedrivesdk.OneDriveClient(api_base_url, auth_provider, http_provider)
auth_url = client.auth_provider.get_auth_url(redirect_uri)
# Ask for the code
print('Paste this URL into your browser, approve the app\'s access.')
print('Copy everything in the address bar after "code=", and paste it below.')
print(auth_url)
code = input('Paste code here: ')

client.auth_provider.authenticate(code, redirect_uri, client_secret)

When I paste the 'auth_url' in the browser I get:

unauthorized_client: The client does not exist or is not enabled for consumers. If you are the application developer, configure a new application through the App Registrations in the Azure Portal at https://go.microsoft.com/fwlink/?linkid=2083908.

@jseguelh
Copy link

jseguelh commented Jan 27, 2022

i have the same problem, did you find the solution?

@KTibow
Copy link

KTibow commented Jan 27, 2022

Make sure in Azure the redirect URI is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants