#✅ - amplify v6 Resource Config usage with userpool client with a secret

24 messages · Page 1 of 1 (latest)

glacial escarp
#

Hello all, I have been stumbling through the documentation and GitHub issues to see how to configure amplify with a userpool that uses a secret. I need to add the client_secret parameter to the post of the token endpoint or add it to the body.

Is this possible? I'm using Typescript and the property isn't available in the ResourceConfig type or anywhere in the Cognito Auth.

Thanks in advance!

random merlin
#

👋 are you looking to configure a new Cognito resource with some OAuth credentials? or use aws-amplify a la carte with your own token provider?

glacial escarp
#

I'm using OAuth with an already up and running userpool and userpool client

#

Based on this documentation, I need to provide the client_secret along with the post that amplify helps configure.

https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html

#

Right now, I get an
OAuthExceptionError: invalid_client

random merlin
#

what provider are you using? In gen2's defineAuth you can specify externalProviders with OAuth credentials

glacial escarp
#

Sorry, I'm a little confused. I'm just using a Cognito LoginWith oAuth. So my provider is Cognito

#

This isn't external

random merlin
#

oh! I misunderstood, then. if you're using aws-amplify you shouldn't need to do any additional configuration outside the original Amplify.configure() 🙂

glacial escarp
#

That's what I thought

#

But the client has a secret and amplify isn't passing in the client secret nor does it have a configuration property for me to add it in the ConfigResources type

#

Is this a bug?

random merlin
glacial escarp
#

Yes

#

With a secret

random merlin
#

after chatting with the team this is intentional as you do not want to expose the client secret. in a server context it is a bit different

glacial escarp
#

Okay, so what's the best practice moving forward?

#

More specifically, where do I configure amplify to send data in the post body?

#

It seems like allowing me to handle the hash is fine, but I need a mechanism to update the post body, right?

random merlin
#

👋 sorry for the delay, are you still experiencing this? are you looking to use this token received from cognito to call some API endpoint?

hollow moatBOT
#

✅ - amplify v6 Resource Config usage with userpool client with a secret