---
title: "Hari Krishnan Murthy (@harikrishnanmurthy) | Hashnode"
description: "Java / integration developer. Read the latest articles by Hari Krishnan Murthy on Hashnode."
url: "https://hashnode.com/@harikrishnanmurthy"
---

@harikrishnanmurthy

# Hari Krishnan Murthy

@harikrishnanmurthy · Joined November 2022

Java / integration developer

## Comments

[Hey there, So I was trying to improvise on this amplify authentication by adding a custom attribute to the sign up screen. After fiddling around for a couple of weeks and skimming tons of articles on the internet, I found a way to do this. 1) After executing amplify add auth we need to execute the following command: amplify override auth This will create a new file called override.ts in the amplify folder. You then paste the following snippet within the enclosing function in this file: const myCustomAttribute = { attributeDataType: 'String', developerOnlyAttribute: false, mutable: true, name: '<name of your attribute for eg registration\_code>', required: false, } resources.userPool.schema = \[ ...(resources.userPool.schema as any\[\]), // Carry over existing attributes (example: email) myCustomAttribute, \] 2) Execute amplify push 3) Once push is done, you should be able to see your new attribute under "custom attributes" in the AWS cognito pool. 4) In your react code, you modify the withAuthenticator section like below: export default withAuthenticator(PatientList, { formFields: formFields, signUpAttributes:\['email', 'custom:<your attribute same as in override.ts>'\], components: { SignIn: { Header: Header, } } }); where formFields should look like: const formFields = { signUp: { username: { order: 1, }, password: { order: 2, }, confirm\_password: { order: 3, }, email: { order: 4, }, 'custom:<your attribute name as in override.ts>': { order: 5, label: "<custom\_label\_name>" }, }, }; Hope this helps someone.](https://hashnode.com/posts/build-an-authentication-system-with-aws-amplify-cognito-and-react/60c228941e145957d5af5a4e/comment/642d07f2480bd310626c1203)

Comment · Article · Apr 5, 2023 · [Build an Authentication System with AWS Amplify, Cognito and React](https://hashnode.com/posts/build-an-authentication-system-with-aws-amplify-cognito-and-react/60c228941e145957d5af5a4e)

[Hey Victoria, Thanks a ton for the article. I followed it to the 'T' and it almost got me there. I had to do minor tweaks to get this to work for the latest version aws amplify. I am listing the tweaks I had to do to get this working in my case. Hopefully, it helps someone who is looking for leads like me: 1) I had to wrap Amplify inside {} to get it to work. Else I got an import error on app startup import { Amplify } from 'aws-amplify'; 2) I had to import the css explicitly since it is no longer part of the amplify dist I suppose: import '@aws-amplify/ui-react/styles.css'; 3) AmplifySignOut is no longer supported. I had to use Authenticator and wrap the code within { signOut, user }. For example: return ( <Authenticator> {({ signOut, user }) => ( <div className="App"> <Alert variant="success"> <Alert.Heading>Hey, {user.username}</Alert.Heading> <p> Thanks for using abcdef &#10084; </p> <hr /> <p className="mb-0"> Would you like to sign out from this device? </p> </Alert> <button className="btn btn-info mr-2" onClick={signOut}>Sign out</button> </div> )} </Authenticator> ); Other than these, the tutorial worked like a charm. Keep rocking :)](https://hashnode.com/posts/build-an-authentication-system-with-aws-amplify-cognito-and-react/60c228941e145957d5af5a4e/comment/63aeba5a2381e73bbf93bba7)

Comment · Article · Dec 30, 2022 · [Build an Authentication System with AWS Amplify, Cognito and React](https://hashnode.com/posts/build-an-authentication-system-with-aws-amplify-cognito-and-react/60c228941e145957d5af5a4e)

[Wilson KOMLAN Hi Wilson, Just to give an update, I used the auth URL in the format you mentioned: << https://<clientId>.auth.<aws-region>.amazoncognito.com/login >> but I still couldn't get it to work. I was able to sign in, was redirected to the callback URI with an auth code on browser but postman kept complaining invalid\_client and was never able to fetch a token. So I created a new app client with a client secret, used that to signin and get an auth code from the /login endpoint. I then manually called the oauth2/token endpoint in a new tab via postman using this auth code and bunch of other attributes as mentioned in the below guide: https://medium.com/vedity/aws-cognito-token-generation-for-rest-api-calls-d32ce909894c and managed to generate the token. I was then able to use the token to call my spring boot API. So instead of doing it in 1 step, I ended up doing 2 steps but I am mighty pleased that my API is secure with AWS cognito, all thanks to you. I am now planning to try out your Spring boot API + AWS Fargate guide. Thanks a lot mate! God bless you!](https://hashnode.com/posts/how-to-secure-spring-boot-rest-api-endpoints-with-amazon-cognito/6298a92e73bf2e0f1abca1e7/comment/636b6bb84a0ea2f5b5b6ff4a#reply-636dd5dfea115907a994b164)

Reply · Article · Nov 11, 2022 · [How to secure Spring boot REST API endpoints with Amazon Cognito](https://hashnode.com/posts/how-to-secure-spring-boot-rest-api-endpoints-with-amazon-cognito/6298a92e73bf2e0f1abca1e7)

[Hi Wilson, Thanks for the very informative article. I followed your blog step by step up until the point where I need to sign up/sign in to generate a token via postman. The auth URL in your screenshot looks like: https://<clientId>.auth.<aws-region>/login but when I use my clientId and aws-region, it doesnt work. Am I missing something? Also is the auth URL same as domain because my domain looks like: https://<app-name>.auth.<aws-region>](https://hashnode.com/posts/how-to-secure-spring-boot-rest-api-endpoints-with-amazon-cognito/6298a92e73bf2e0f1abca1e7/comment/636b6bb84a0ea2f5b5b6ff4a)

Comment · Article · Nov 9, 2022 · [How to secure Spring boot REST API endpoints with Amazon Cognito](https://hashnode.com/posts/how-to-secure-spring-boot-rest-api-endpoints-with-amazon-cognito/6298a92e73bf2e0f1abca1e7)
