def renewAuth(): ''' If auth is expired renew the authorization token with the use of password. ''' password = request.data password = json.loads(password) password = password['password'] logger.debug('password is:%s', password) s = URLSafeSerializer(globalS.dictDb['SECRET_KEY']) ID = s.loads(password)[0] storedPswd = intercom.verifyAuthUser(ID) if password == storedPswd: #generete a new token valid for 30mins serialized = generate_auth_token(ID, 1800) #update user data when it was renewed return json.dumps({'Authorization': serialized}) else: return make_response('Bad apssword Token', 401)
def renewAuth(): ''' If auth is expired renew the authorization token with the use of password. ''' password = request.data password = json.loads(password) password = password['password'] logger.debug('password is:%s',password) s = URLSafeSerializer(globalS.dictDb['SECRET_KEY']) ID=s.loads(password)[0] storedPswd = intercom.verifyAuthUser(ID) if password == storedPswd: #generete a new token valid for 30mins serialized = generate_auth_token(ID,1800) #update user data when it was renewed return json.dumps({'Authorization':serialized}) else: return make_response('Bad apssword Token',401)
def renewAuth(): """ If auth is expired renew the authorization token with the use of password. """ password = request.data password = json.loads(password) password = password["password"] logger.debug("password is:%s", password) s = URLSafeSerializer(globalS.dictDb["SECRET_KEY"]) ID = s.loads(password)[0] storedPswd = intercom.verifyAuthUser(ID) if password == storedPswd: # generete a new token valid for 30mins serialized = generate_auth_token(ID, globalS.dictDb["AUTH_EXPIRY_SECS"]) # serialized = generate_auth_token(ID,1800) # update user data when it was renewed return json.dumps({"Authorization": serialized}) else: return make_response("Bad apssword Token", 401)