Results of 1 - 5 of about 5 for Authenticate (0.009 sec.)
- OAuth2 scopes 11950
- OAuth2 scopes Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . You can use OAuth2 scopes directly with FastAPI , they are integrated to work seamlessly. This would
...def get_user ( db , username : str ): if username in db : user_dict = db [ username ] return UserInDB ( ** user_dict ) def authenticate_user ( fake_db , username : str , password : str ): user = get_user ( fake_db , username ) if not user : return False if n...( security_scopes : SecurityScopes , token : Annotated [ str , Depends ( oauth2_scheme )] ): if security_scopes . scopes : authenticate_value = f 'Bearer scope=" { security_scopes . scope_str } "' else : authenticate_value = "Bearer" credentials_exception =...TTPException ( status_code = status . HTTP_401_UNAUTHORIZED , detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : authenticate_value }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payl... - https://man.mtool.work/fastapi/0.115/advanced/security/oauth2-scopes/
- パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer 10663
- パスワード(およびハッシュ化)によるOAuth2、JWTトークンによるBearer これでセキュリティの流れが全てわかったので、 JWT トークンと安全なパスワードのハッシュ化を使用して、実際にアプリケーションを安全にしてみましょう。 このコードは、アプリケーシ
...def get_user ( db , username : str ): if username in db : user_dict = db [ username ] return UserInDB ( ** user_dict ) def authenticate_user ( fake_db , username : str , password : str ): user = get_user ( fake_db , username ) if not user : return False if n...TTPException ( status_code = status . HTTP_401_UNAUTHORIZED , detail = "Could not validate credentials" , headers = { "WWW-Authenticate" : "Bearer" }, ) try : payload = jwt . decode ( token , SECRET_KEY , algorithms = [ ALGORITHM ]) username = payload . get...st ( "/token" ) async def login_for_access_token ( form_data : OAuth2PasswordRequestForm = Depends (), ) -> Token : user = authenticate_user ( fake_users_db , form_data . username , form_data . password ) if not user : raise HTTPException ( status_code = sta... - https://man.mtool.work/fastapi/0.115/tutorial/security/oauth2-jwt/
- Simple OAuth2 with Password and Bearer 8438
- Simple OAuth2 with Password and Bearer Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . Now let's build from the previous chapter and add the missing parts to have
...xception ( status_code = status . HTTP_401_UNAUTHORIZED , detail = "Invalid authentication credentials" , headers = { "WWW-Authenticate" : "Bearer" }, ) return user async def get_current_active_user ( current_user : Annotated [ User , Depends ( get_current_u...xception ( status_code = status . HTTP_401_UNAUTHORIZED , detail = "Invalid authentication credentials" , headers = { "WWW-Authenticate" : "Bearer" }, ) return user async def get_current_active_user ( current_user : Annotated [ User , Depends ( get_current_u...xception ( status_code = status . HTTP_401_UNAUTHORIZED , detail = "Invalid authentication credentials" , headers = { "WWW-Authenticate" : "Bearer" }, ) return user async def get_current_active_user ( current_user : Annotated [ User , Depends ( get_current_u... - https://man.mtool.work/fastapi/0.115/tutorial/security/simple-oauth2/
- HTTP Basic Auth 7887
- HTTP Basic Auth Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . For the simplest cases, you can use HTTP Basic Auth. In HTTP Basic Auth, the application expects a
...a username and a password. If it doesn't receive it, it returns an HTTP 401 "Unauthorized" error. And returns a header WWW-Authenticate with a value of Basic , and an optional realm parameter. That tells the browser to show the integrated prompt for a userna...TTPException ( status_code = status . HTTP_401_UNAUTHORIZED , detail = "Incorrect username or password" , headers = { "WWW-Authenticate" : "Basic" }, ) return credentials . username @app . get ( "/users/me" ) def read_current_user ( username : Annotated [ st...TTPException ( status_code = status . HTTP_401_UNAUTHORIZED , detail = "Incorrect username or password" , headers = { "WWW-Authenticate" : "Basic" }, ) return credentials . username @app . get ( "/users/me" ) def read_current_user ( username : Annotated [ st... - https://man.mtool.work/fastapi/0.115/advanced/security/http-basic-auth/
- Custom Docs UI Static Assets (Self-Hosting) 6986
- Custom Docs UI Static Assets (Self-Hosting) Warning The current page still doesn't have a translation for this language. But you can help translating it: Contributing . The API docs use Swagger UI and ReDoc , and each of those need some Jav
...er_ui_redirect is a helper for when you use OAuth2. If you integrate your API with an OAuth2 provider, you will be able to authenticate and come back to the API docs with the acquired credentials. And interact with it using the real OAuth2 authentication. Sw...er_ui_redirect is a helper for when you use OAuth2. If you integrate your API with an OAuth2 provider, you will be able to authenticate and come back to the API docs with the acquired credentials. And interact with it using the real OAuth2 authentication. Sw... - https://man.mtool.work/fastapi/0.115/how-to/custom-docs-ui-assets/
PREV
1
NEXT