next-auth icon indicating copy to clipboard operation
next-auth copied to clipboard

Cognito Provider Documentation Update

Open howardkitto opened this issue 1 year ago • 6 comments
trafficstars

What is the improvement or update you wish to see?

The docs here: https://next-auth.js.org/providers/cognito

Refer to these settings:

image

The aws UI must have changed - it took me a while to find these settings - they are in appclient / hosted UI and before you can set them you must set up a cognito domain. They look like this now:

Screenshot 2024-01-16 at 12 28 14

Wasted quite a while figuring that out!

It would also be great to include the cloudformation template for this

Is there any context that might help us understand?

I'm trying to create a secure custom authflow for my AWS SAM backend

Does the docs page already exist? Please link to it.

https://next-auth.js.org/providers/cognito

howardkitto avatar Jan 16 '24 12:01 howardkitto

I wrrited the blog post and sample code. take a look https://dev.to/dango0812/nextauth-with-aws-cognito-email-google-sign-in-5ef6

dango0812 avatar Jan 26 '24 16:01 dango0812

@dango0812 is your setup compatible with edge middleware or is Cognito in general not compatible?

kylemh avatar Mar 01 '24 15:03 kylemh

@dango0812 is your setup compatible with edge middleware or is Cognito in general not compatible?

Middleware and Cognito are unrelated, could you please provide more details or clarification on the topic you want to inquire about?

dango0812 avatar Mar 05 '24 01:03 dango0812

I was looking at the repository linked at the end of the blog post and found no examples surrounding auth-gating with middleware.

kylemh avatar Mar 05 '24 02:03 kylemh

@kylemh I apologize for contacting you late. To handle authentication and redirection after verification in the middleware, you can access it through 'getToken' and process accordingly.

sample code

import { getToken } from "next-auth/jwt";
const session = await getToken({ req, secret: process.env.NEXTAUTH_SECRET });
// your session object key check and redirect

if ...
return NextResponse.redirect(new URL(""))

dango0812 avatar Apr 03 '24 06:04 dango0812

is this still open ?

Dxuian avatar Oct 09 '24 00:10 Dxuian

It looks like this issue did not receive any activity for 60 days. It will be closed in 7 days if no further activity occurs. If you think your issue is still relevant, commenting will keep it open. Thanks!

stale[bot] avatar Jan 21 '25 23:01 stale[bot]

To keep things tidy, we are closing this issue for now. If you think your issue is still relevant, leave a comment and we might reopen it. Thanks!

stale[bot] avatar Jan 31 '25 22:01 stale[bot]