Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

209
Views
Can i use my own sign in form for aws cognito?

I have a nextjs app that use aws cognito for auth. i was wondering if there is a way to replace the hosted ui provided by aws with my own custom form.

import { Domain } from "@material-ui/icons";
import NextAuth from "next-auth";
import Providers from "next-auth/providers";

export default NextAuth({
    providers:[
        Providers.Cognito({
            clientId:process.env.COGNITO_CLIENT,
            clientSecret:process.env.COGNITO_CLIENT_SECRET,
            domain: process.env.COGNITO_DOMAIN
        })

        
    ]
})
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Technically, yes it is possible, but @alexrogo answer is misleading. Amplify, apart from being highly questionable (just look at open tickets on github), doesn't use OpenIDConnect standard. It's doing direct Cognito initiateAuth operation which returns tokens without openid scope. If you try to call e.g. /userinfo endpoint on Cognito, that will fail. Also Amplify keeps tokens in either local storage or cookies depending how you configure it but it's no httponly cookie... That's very troublesome.

But that being said, it is possible to replace HostedUI but beware, as HostedUI is not just a UI! It's a full authorization server. And you have to implement those functionalities yourself if you want to omit its login page. See here for more details: AWS Cognito Authorization code grant flow without using the hosted UI

about 4 years ago · Juan Pablo Isaza Report

0

Yes, this is possible.

You can connect your own UI components to Cogntio's APIs. You can store your authentication token in the state or localstorage. Take a look at this Documentation.

There you will find every neccesary function, including Sign Up, Sign In, Log out, Change User Attributes, refreshing tokens.

about 4 years ago · Juan Pablo Isaza Report

0

Just to follow up with @alexrogo Amplify has a whole built in UI connected component system, so you don't have to build your custom UI by yourself. This is the getting started guide.

The default flow when you setup a new user pool with Amplify is the USER_SRP_AUTH flow. The Cognito Hosted UI has options for OAuth 2.0 federation and OpenID Connect

With that said, if you prefer, you can setup federated OAuth 2.0 accounts with the Amplify UI, as seen here.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!