async def login( request: typing.Any, username: str, password: str, api: cannula.API, ) -> bool: resp = await api.call( LOGIN_MUTATION, variables={ 'username': username, 'password': password, }, request=request ) if resp.errors: LOG.error(f'{resp.errors}') raise Exception('Unable to login user') LOG.info(f'Auth Response: {resp.data}') token = resp.data['login'] user = set_user( username=token['user']['name'], auth_token=token['authToken'], catalog=token['catalog'], roles=token['roles'] ) response = RedirectResponse('/dashboard') response.set_cookie(SESSION_COOKE_NAME, user.session_id) return response
def add_patient(patient: Patient, is_logged: bool = Depends(is_logged)): app.storage[app.counter] = patient response = RedirectResponse(url=f"/patient/{app.counter}") app.counter += 1 return response
async def login(request: Request, form: OAuth2PasswordRequestForm = Depends()): return RedirectResponse(url=request.url_for("auth.token"), status_code=307)
def redirect_to_homepage(request): return RedirectResponse("/")
def logout(session_token: str = Cookie(None)): check_token(session_token) app.tokens_list = [i for i in app.tokens_list if i != session_token] return RedirectResponse(url="/")
def main(): return RedirectResponse(url="/docs/")
async def logout(request: Request): request.session.pop('user', None) return RedirectResponse(url='/')
async def get_api_docs(): response = RedirectResponse(url='/redb/redoc') return response
def logout(self, request: Request, callback_url: str) -> RedirectResponse: SessionManager(request=request).clear() logout_url = f"{self.client_config.authority}/oauth2/v2.0/logout?post_logout_redirect_uri={callback_url}" return RedirectResponse(url=logout_url)
async def index(): """ Redirects to the docs. """ return RedirectResponse(url="/redoc")
def redirect_to_docs(): redirect_url = "/api/v2/docs" # replace with docs URL or use app.url_path_for() return RedirectResponse(url=redirect_url)
async def redirect_to_docs(): return RedirectResponse(url=DOCS_URL)
async def redirect(request): return RedirectResponse(await get_url(request))
async def auth(request): async with spotify.Client(CLIENT_ID, CLIENT_SECRET) as client: url = client.oauth2_url( redirect_uri=get_redirect_uri(request), scopes=['user-library-read', 'playlist-modify-public']) return RedirectResponse(url)
async def route_logout_and_remove_cookie(): response = RedirectResponse(url="/") response.delete_cookie(API_KEY_NAME, domain=COOKIE_DOMAIN) return response
def index(request: Request, return_to: str = ""): if return_to: logger.warning(f"Redirecting to: {return_to}") return RedirectResponse(url=return_to) return {'status': 'OK'}
async def redirect_handler(request: Request, exc: HttpRedirect): return RedirectResponse(exc.location, status_code=exc.status)
def docs_redirect(): return RedirectResponse(f"{openapi_prefix}/docs")
def root(): return RedirectResponse("static/index.html")
def authorization_redirect(): """Redirect authorization requests to the Webex Teams OAuth flow.""" logger.info("Redirecting to Webex Teams OAuth flow") user_key = uuid.uuid4() return RedirectResponse( f"{WEBEX_TEAMS_OAUTH_AUTHORIZATION_URL}&state={user_key}")
async def http_not_found_handler(request: Request, exc: Exception): return RedirectResponse(request.url_for('databases'))
def login(response: Response, session_token=Depends(get_current_username)): response = RedirectResponse(url="/welcome") response.set_cookie(key="session_token", value=session_token) return response
async def authorize(request: Request): token = await oauth2_client.orcid.authorize_access_token(request) request.session["token"] = token return RedirectResponse(url="/")
def redirect(url: str) -> RedirectResponse: return RedirectResponse(url, status_code=HTTP_303_SEE_OTHER)
async def logout(request: Request): request.session.pop("token", None) return RedirectResponse(url="/")
def index(): return RedirectResponse(url="index.html")
def root(): return RedirectResponse('/docs', 301)
async def logout(is_logged: bool = Depends(is_logged)): response = RedirectResponse(url="/") response.delete_cookie("session") return response
def root() -> Any: return RedirectResponse("./docs")
async def route_root(request: Request): return RedirectResponse("/pay")
async def get_video(request): redirect_url = get_video_node(request) if redirect_url: return RedirectResponse(redirect_url) else: return HTMLResponse('404 Not found.', 404)