Any authentication package for python

I am building an application which will help user to create meetings.
In my application, I cache user’s access token and refresh token and use them when needing to create meeting on behalf of the user.
There are quite a few steps before using the access token for an api call for meeting creation.

  1. try the access token, if failed try to get new one with refresh_token
  2. if refresh token is expired, need to refresh refresh_token, then get a new access token again
    Is there any python package we can use to streamline this without creating our own code?

Welcome, @zhi.zhang.unai,

Welcome to the Developer Forum! Currently, we do not have any sample apps demonstrating the OAuth flow with python. However, it looks like several python OAuth libraries you can consider:

https://oauth.net/code/python/

You can streamline this process using Python packages like requests or oauthlib , which offer functionalities to handle OAuth2 authentication, token management, and API calls seamlessly. The oauthlib library provides robust support for OAuth1 and OAuth2 protocols, allowing you to manage access tokens, refresh tokens, and the authentication flow efficiently. Similarly, requests is a versatile HTTP library that can handle OAuth2 authentication and perform API requests with access tokens. Both can simplify the token management process, reducing the need for manually handling token validation, refreshing, and obtaining new access tokens.