tokusumi / fastapi-cloudauth

Simple integration between FastAPI and cloud authentication services (AWS Cognito, Auth0, Firebase Authentication).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"not verified" response - cognito

JustinGuese opened this issue · comments

Hi, maybe I am missing something obvious, but when authenticating using an auth token from cognito, the fastapi-cloudauth responds with 401 {"detail": "Not verified"}

This does not refer to the user I guess, as the user is email & phone verified, but does it refer to the domain (localhost, local dev)?
How would I test my app locally then?

I hope you can point me in the right direction, as this package would be awesome to use!

There are two types of token available in Cognito: IdToken and AccessToken. Make sure that you are using correct one.

Can I check which of these is considered "correct"?

We've an API Gateway in front of an app. which uses fastapi-cloudauth and the Gateway seemingly accepts either. fastapi-cloudauth, however, seems only to accept the IdToken.

Not sure if I missed something in the docs
as to why that would be or if it's configurable…?

Ignore me: I RTFM'd a little harder and that first example finally clicked (AccessUser for the AccessToken; CognitoClaims for the IdToken.)

I've implemented the code exactly as listed in the documentation for get_current_user, but regardless of if I pass the idToken or accessToken I still receive {detail: 'Not verified'}.

@JLongley, can I check how you're getting the tokens? And how you're forming the requests?

I've just copy/pasted the example from the README and it's seemingly working for both ID and Access tokens.