I'm trying to authenticate against an Amazon Cognito Api, however it's not working...
Creating a CognitoUserPool
for registering and signing in works. But how to proceed form here on?
In onSuccess(cognitoUserSession: CognitoUserSession)
gives me a session, from which I can get a jwtToken
(userSession.accessToken.jwtToken
).
How to use the session in combination with the ApiFactor?
val api: DevetrackcommercialplaygroundClient = ApiClientFactory()
.apiKey(apiKey)
.build(Client::class.java)
val get= api.getFoo("id") // no auth; works
val post = api.postBar("id", something) // has auth; doesn't work
Always gives me 401. Both, if I set apiKey
to the api key and also if I set it to the jwtToken
.
So how can I use CognitoUserSession
and ApiClientFactory
in conjunction?