![]()
Hi Vivek,
Whenever generating a new access token use a fresh auth code.
how can I reuse the old auth code?
def get_access_token():
if not os.path.exists('access_token.txt'):
session=accessToken.SessionModel(client_id=app_id,secret_key=app_secret,redirect_uri=redirect_url, response_type="code", grant_type="authorization_code")
response =session.generate_authcode()
print("Login URL:",response)
auth_code =input("enterAuthCode")
session.set_token(auth_code)
access_token = session.generate_token()["access_token"]
**with open('access_token.txt','w') as f:**
** f.write(access_token)**
else:
** with open('access_token.txt','r') as f:**
** access_token = f.read()**
return access_token
Try it out i got somewhere , store the auth key locally at .txt and use it.
Dear udhayakumar nadaraj thank you for your response. But I have already tried this way. But once you generate new session then old auth token will get expire.