def save_grant(client_id, code, request, *args, **kwargs): expires = datetime.now() + timedelta(seconds=_THOUSAND_DAY) return Grant.create(g.user.id, client_id, code['code'], request.redirect_uri, request.scopes, expires=expires)
def load_grant(client_id, code): return Grant.get_by_code_and_client(code, client_id)