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

Manisha Mohanty 15 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 | Windows | Classic Outlook for Windows | For business
Microsoft Security | Microsoft Graph
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.