Error while working on authentication of one drive “KeyError: ‘expires_in’”

Solution for Error while working on authentication of one drive “KeyError: ‘expires_in’”
is Given Below:

I am trying to connect to onedrive and download files to my local. But when i try to do authentication i am getting error.

Traceback (most recent call last):
  File "/Users/rishi/PycharmProjects/pythonProject1/venv/testing2.py", line 37, in <module>
    graph_client.login()
  File "/Users/rishi/PycharmProjects/pythonProject1/venv/ms_graph/client.py", line 262, in login
    self.grab_access_token()
  File "/Users/rishi/PycharmProjects/pythonProject1/venv/ms_graph/client.py", line 308, in grab_access_token
    token_dict=token_dict
  File "/Users/rishi/PycharmProjects/pythonProject1/venv/ms_graph/client.py", line 144, in _state
    ) + int(token_dict['expires_in'])
KeyError: 'expires_in'

Process finished with exit code 1

I have used the code provided in github. After login and giving permission, i copied and pasted the link, after that i got this error. Could anyone help me where i went wrong.

I have used the steps provided in youtube.

Looks like there is some configuration error while setting up the expiry time in client.py class.
Please try logout and sign-in again.

  • Check if any value (other than 0)of expiry parameter is set(in expires_in parameter of access_token which of type int). See if access token is empty.
  • The default lifetime of an access token varies, depending on the
    client application requesting the token. When the access token
    expires, the client must use the refresh token to (usually silently)
    acquire a new refresh token and access token.
  • You can adjust the lifetime of an access token to control how often
    the client application expires the application session, and how often
    it requires the user to re-authenticate. You could update or create a
    new connection to the connector before the Flow Access Token Expires.

See –Information about active-directory-configurable-token-lifetimes
and Configure-token-lifetimes,get-started

Reference:
One drive Authentication and sign-in-MS Docs