How to fix [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)

Manisha Mohanty 10 Reputation points
2024-02-19T13:20:54.5033333+00:00

I am trying to use Microsoft Graph API to access outlook mail to develop a program which will monitor the mailbox.While trying to implement the sample code outlined below -

https://learn.microsoft.com/en-us/graph/tutorials/python?tabs=aad&tutorial-step=2

I am encountering the following error - azure.core.exceptions.ClientAuthenticationError: Authentication failed: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1000)

I have tried -

  1. installing certifi
  2. upgrading certifi
  3. installing certifi_win32
  4. installing certificates
  5. disabling expired certificated
  6. using verify=False which is not recommended, but still this error comes up after a point
  7. setting REQUESTS_CA_BUNDLE env variable to force requests library to use the cacert.pem
  8. Adding the intermediate cert to the cacert.pem

Nothing seems to work. I am using Windows and trying to run the python scripts on command prompt.

Outlook
Outlook
A family of Microsoft email and calendar products.
3,012 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,669 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Royal Dsouza 0 Reputation points
    2024-04-11T11:18:54.9033333+00:00

    I'm also facing the same issue. Let me know if you were able to fix this issue.

    0 comments No comments