Comments (7)
@spawn-guy sorry for late response.
would you mind post your solution for other user?
from fastapi-cloudauth.
we've found a different and an easier way as documentation suggests
from fastapi-cloudauth.
even though we migrated to fastapi-auth0
(although i wanted to use this one as this one has support for a few jwt issuers) - we've decided to not to instantiate it as a dependency injection, but as a "global" namespaced instance
file: app/core/auth.py
from fastapi_cloudauth import Auth0
auth0 = Auth0(domain=domain=AUTH0_DOMAIN)
then in another route we can use it as
from app.core.auth import auth0
@router.get("/something",
response_model=Any,
dependencies=[
Depends(auth0.scope("read:something"))
]
)
async def get_something(
request: Request
):
return []
the Depends/Security
will cache the instance between the calls
from fastapi-cloudauth.
This issue is closed, but I still have a question and faced with exact problem, so how to use Cognito/Auth0.. etc instance as a part of app context. Any thoughts?
from fastapi-cloudauth.
it's been some time, so i don't recall many things, but
@tivaliy try the snippet above. but replace Auth0
with Cognito
.
create an instance in 1 file (app/core/auth.py
) - import that instance in the router(s)
from fastapi-cloudauth.
Thank you for the response, but the idea in my case is to use exact approach you mentioned in the very beginning of this thread.
from fastapi-cloudauth.
Thank you for the response, but the idea in my case is to use exact approach you mentioned in the very beginning of this thread.
Well, good luck. Let us know when/if you will figure it out
from fastapi-cloudauth.
Related Issues (20)
- Add required scopes to generated OpenAPI documentation
- Cannot access `/users/` using the AWS Cognito configuration HOT 2
- Firebase - Unauthenticated request is not raising an exception HOT 1
- Standalone function to verify token
- firebase.JWKS public keys expire and don't get refreshed HOT 2
- Cognito "iat" claim set in the future HOT 1
- Add ability to specify `user_info` as an extra parameter when instantiating `UserInfoAuth` derived classes HOT 1
- "not verified" response - cognito HOT 5
- Enfore that a user's e-mail is verified in Auth0 for accessing an API
- Clarification on Role Based Access Control (RBAC) using firebase auth HOT 1
- cognito: "Validation Error for Claims" - when using custom attributes in cognito HOT 1
- How to catch exception or change the Scope not matched message
- Simple Auth0 authentication when using the doc or redoc page
- [Cognito] App client_id is not validated for Cognito JWT (access_token)
- Take lot of time to start a fastapi project
- Having trouble figuring out "next steps" HOT 1
- How can I get the groups/scopes a user is associated in Cognito? HOT 1
- Feature: Add scopes required to the openapi docs
- How can we make it possible to enable Authentication for Websockets?
- how to add google login?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fastapi-cloudauth.