Fork me on GitHub
#fulcro
<
2022-01-20
>
xceno11:01:39

I searched this channel history for folks that used AWS Cognito together with Fulcro and it seems some of you have done this in various ways. If anyone remembers, what's the "best" way to do it (`AWS amplify` vs. custom implementations)? Our application is running as Datomic Ion. The SPA is served by the same backend that contains the business logic (as opposed to serving it from S3). Right now I'm thinking about serving a login-screen from a public route, and keep everything else behind a secured route that watches for a Cognito token

hadils12:01:29

I am working with AWS Amplify right now. To expedite implementation, I am using the Authenticator component from the Amplify React UI library. If you are going to craft your own signup signin, etc. then I suggest creating a remote for async JS functions. This can be built from examples in the Developer’s Guide and copying code from the Fulcro Github repo.

hadils12:01:26

I am currently working on keeping track of state — CognitoUser and tokens.

xceno13:01:07

Thanks for the reply! I've seen a YT tutorial on amplify where they wrap their entire react app in a withAuthentication(app) call, and that's what I like to do as well. The CognitoUser comes from the Cognitor JWT right? So I think parsing the token and adding some user info back to the request header might work (like https://github.com/JarrodCTaylor/ion-cognito-exemplar/blob/main/src/ion_cognito_exemplar/middleware/token_auth.clj). Is there anything else you keep track of directly in fulcro, like a refresh token or something? I assumed that the withAuthentication HOC from amplify takes care of everything, including token refreshes and such. Are you also using the Amplify CLI?

hadils15:01:37

I am using the Amplify CLI and the dashboard, which is extremely helpful for managing users. withAuthenticator HOC is definitely a way to go. Amplify lib handles all the token refresh for you — I did not need to process tokens on my own back end.

xceno15:01:59

Awesome, I'll give it a try then. Thanks again!

xceno11:01:39

@UGNMGFJG3 Sorry for bothering you again, but I was just wondering if you're also using Datomic Ions? If so, did you add your Cognito Authorizer to the AWS API Gateway?

roklenarcic13:01:26

When using forms, when a field is invalid, is there a way to communicate why it is invalid?

janezj15:01:48

Is there a simple way to show toast messages that will automatically disappear, Some proven react component? that goes well with semantic ui

xceno15:01:25

react-toastify works very well, I use it for several years now in many different projects. The pathom3 branch of the fulcro-rad-demo has it baked in: https://github.com/fulcrologic/fulcro-rad-demo/blob/pathom3/src/shared/com/example/client.cljs#L42

janezj16:01:26

Thanks! It works great. with :pauseOnFocusLoss false, just as I want

roklenarcic20:01:20

In a form I want to convert a field between the input representation (like XXXX-YYYY-ZZZZ) and the model which is XXXXYYYYZZZZ. So I need to change the display of the value but also adjust what user enters as well. What’s the easiest way to plug something like that in?

roklenarcic08:01:16

what I am looking for