Open dyslechtchitect opened 4 months ago
Hi, I've setup my fastapi-cloudauth as the readme describes in Example (AWS Cognito), but can't see anywhere to specify my cognito callback URL and I'm getting a 401 error with:
Example (AWS Cognito)
{ "detail": "JWK public Attribute for authorization token not found" }
i'm calling my server like:
curl --location 'http://127.0.0.1:5000/access' \ --header 'Authorization: Bearer XXX
and my code is basically the hello world example:
import uvicorn from pydantic import BaseModel from fastapi import FastAPI, Depends from fastapi_cloudauth.cognito import Cognito, CognitoCurrentUser, CognitoClaims app = FastAPI() auth = Cognito( region="eu-xxxx, userPoolId="eu-north-xxxx", client_id="xxxx" ) @app.get("/", dependencies=[Depends(auth.scope(["read:users"]))]) def secure(): # access token is valid return "Hello" class AccessUser(BaseModel): sub: str @app.get("/access/") def secure_access(current_user: AccessUser = Depends(auth.claim(AccessUser))): # access token is valid and getting user info from access token return f"Hello", {current_user.sub} get_current_user = CognitoCurrentUser( region="eu-xxxx, userPoolId="eu-north-xxxx", client_id="xxxx" ) @app.get("/user/") def secure_user(current_user: CognitoClaims = Depends(get_current_user)): # ID token is valid and getting user info from ID token return f"Hello, {current_user.username}"
`
Hi, I've setup my fastapi-cloudauth as the readme describes in
Example (AWS Cognito)
, but can't see anywhere to specify my cognito callback URL and I'm getting a 401 error with:i'm calling my server like:
and my code is basically the hello world example:
`
Notes: