INNER CODE UNIT · Python
before
LiuChangFreeman/OneIndexServerless · Deploy/Back/main.py:192
def before(*args,**kwargs):
global token
try:
time_now = time.time()
time_last = token["time"]
if time_now - time_last >3500:
refresh_token = token["refresh_token"]
scope = token["scope"]
url = "https://login.microsoftonline.com/common/oauth2/v2.0/token"
headers = {
"Content-Type": "application/x-www-form-urlencoded"
}
data = {
"client_id": client_id,
"client_secret": client_secret,
"redirect_uri": redirect_uri_register,
"refresh_token": refresh_token,
"grant_type": "refresh_token",