A small helper to authenticate Flurl requests for AWS Cognito Identity
- Create a subclass of
CognitoAuthClient
. - Implement the following abstract properties depending on your setup:
ServiceURL
PoolID
IdentityPoolID
ClientID
RegionEndpoint
- Create an instance of your client and call
LoginAsync(string username, string password)
when you are ready to login.
- Import
Extensions
and callWithCognitoAuth(CognitoAuthClient)
, passing in your logged in client as the single parameter. (returns the request for chaining) - Dispatch as you normally would, authentication is handled lazily in the background on an event.
"https://example.com/real_cognito_endpoint/hey".WithCognitoAuth().GetJsonAsync();
- Only async
- Spoofs user agent string