Skip to content

401 Client Error: Unauthorized #902

Open
@lastorder999

Description

@lastorder999

My program for uploading files to SharePoint was working normally until last week. Now, I see an error occurring during the upload process. I tested it using this code, and it’s giving me an error.

from office365.runtime.auth.client_credential import ClientCredential
from office365.sharepoint.client_context import ClientContext

client_id = "[client_id]"
client_secret = "[client_secret]
site_url = "https://example.sharepoint.com/site/ShareDoc"

client_credentials = ClientCredential(client_id, client_secret)
ctx = ClientContext(site_url).with_credentials(client_credentials)
web = ctx.web
ctx.load(web)
ctx.execute_query()

This is the error I received
Screenshot 2024-10-11 154020

Screenshot 2024-10-11 154048

I followed this link for my client_id and client_secret https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs
I don’t understand why this issue is happening because it was normal before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions