marmelab / ra-auth-cognito

An auth provider for react-admin which handles authentication with AWS Cognito.
MIT License
9 stars 6 forks source link

Feature request: an easier way to access to cognito tokens #9

Closed betimer closed 1 year ago

betimer commented 1 year ago

The current work around (https://github.com/marmelab/ra-auth-cognito/issues/6) is not approprite.

Would there be an easier way to access accessTokens or IdTokens for cognito user?

Thanks.

djhi commented 1 year ago

Why is it not appropriate?

betimer commented 1 year ago

@djhi I am still checking if any convenient method e.g. CognitoAuthProvider.getTokens which returns current user's token, instead of going all from cognito native code.

If you already know some work around, please share. much appreciate.

djhi commented 1 year ago

You didn't answer my question

betimer commented 1 year ago

@djhi That's fine. I have checked all the source code of ra-auth-cognito, which does not provide this built-in handy function. I just made a decision to directly go with react instead of react-admin, with other considerations as well.

Thank you for the reply anyway, mate.

abanobmikaeel commented 1 year ago

If we can automatically inject the jwt we get into all requests used by Data Providers, would be pretty nice

djhi commented 1 year ago

Some dataProviders support setting the httpClient for this purpose. See https://marmelab.com/react-admin/fetchJson.html