# AWS Congito "redirect\_mismatch"

**URL:** <https://builder.metamask.io/t/aws-congito-redirect-mismatch/956>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [August 12, 2025, 1:29pm UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956 "2025-08-12T13:29:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aniket-Bhat](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@Aniket-Bhat](https://builder.metamask.io/u/Aniket-Bhat)\
**Post date:** [August 12, 2025, 1:29pm UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/1 "2025-08-12T13:29:49Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **Aniket-Bhat** on 8/12/2025.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

Hi

I’m using the `cognito-implicit-example` example from github, to login via cognito.

My problem was similar to the this guy’s here. [Redirect\_mismatch error for AWS Cognito](https://web3auth.io/community/t/redirect-mismatch-error-for-aws-cognito/6788)

I added the urls, but still I see this error. Given the post is old, has there been any changes in the redirect urls for cognito?

```auto
Allowed callback URLs
http://localhost:3000/callback
https://auth.web3auth.io/auth
https://d84l1y8p4kdic.cloudfront.net
https://testing.openlogin.com/auth

```

```auto
Allowed sign-out URLs
http://localhost:3000
https://auth.web3auth.io/auth
https://testing.openlogin.com/auth

```

---

<div class="post-metadata">

**Author:** ![w3abot](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@w3abot](https://builder.metamask.io/u/w3abot)\
**Post date:** [August 12, 2025, 1:32pm UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/2 "2025-08-12T13:32:32Z")

</div>

Thanks for sharing the details, Aniket! Here’s a summary of your issue and what the support team will need to assist further:

* * *

**Issue Summary**

- **SDK:** Web3Auth Plug and Play (PnP) Web SDK
- **Integration:** AWS Cognito (using the `cognito-implicit-example` from GitHub)
- **Error:** `redirect_mismatch` when attempting to log in via Cognito
- **Steps Taken:** You have already added the following URLs to your Cognito app settings:
  - **Allowed callback URLs:**
    - [http://localhost:3000/callback](http://localhost:3000/callback)
    - [Web3Auth](https://auth.web3auth.io/auth)
    - [https://d84l1y8p4kdic.cloudfront.net](https://d84l1y8p4kdic.cloudfront.net)
    - [https://testing.openlogin.com/auth](https://testing.openlogin.com/auth)

  - **Allowed sign-out URLs:**
    - [http://localhost:3000](http://localhost:3000)
    - [Web3Auth](https://auth.web3auth.io/auth)
    - [https://testing.openlogin.com/auth](https://testing.openlogin.com/auth)

- **Reference:** You linked to a similar community post ([redirect\_mismatch error for AWS Cognito](https://web3auth.io/community/t/redirect-mismatch-error-for-aws-cognito/6788)).

* * *

### Additional Details Needed

To help you further, could you please provide:

1. **Web3Auth SDK Version** you are using (if not latest).
2. **The exact URL** shown in the browser’s address bar when the error occurs (sometimes the redirect URI in the URL can reveal mismatches).
3. **Relevant code snippet** of your Web3Auth initialization and login (especially the `redirectUrl` or any custom parameters passed).
4. **Screenshot of the error** (optional, but can help confirm the exact mismatch).

* * *

### Quick Suggestions & Documentation

- **Ensure the Redirect URI matches exactly:**  
AWS Cognito is very strict about redirect URIs. Even a missing slash or protocol difference can cause a mismatch. Double-check that the URI you pass to Cognito during the OAuth flow (from your Web3Auth config) matches one of the allowed callback URLs in Cognito **exactly**.
- **Check the `redirectUrl` used in your Web3Auth config:**  
In the [Web3Auth Cognito Example](https://github.com/Web3Auth/web3auth-pnp-examples/tree/main/web/cognito-implicit-example), the redirect URI is usually set as `http://localhost:3000/callback` for local development.  
Ensure that this is what’s being sent in the OAuth request.
- **Recent changes:**  
There have not been recent changes to the required redirect URLs for Cognito in the Web3Auth docs, but always ensure your URLs match what is being sent in the actual request.

**Reference:**

- [Web3Auth Docs – Custom Authentication](https://web3auth.io/docs/authentication/custom-authentication/cognito)
- [AWS Cognito Docs – Redirect URIs](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-idp-settings.html)

* * *

**Next Steps:**  
Please reply with the requested details (especially the SDK version and the actual redirect URI in the error) so we can help you debug this quickly!

Let us know if you have any other context or logs to share.

> Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

> Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. [Web3Auth Developer Office Hours](https://web3auth.io/community/t/web3auth-developer-office-hours/8777)

---

<div class="post-metadata">

**Author:** ![Aniket-Bhat](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@Aniket-Bhat](https://builder.metamask.io/u/Aniket-Bhat)\
**Post date:** [August 14, 2025, 9:20am UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/3 "2025-08-14T09:20:30Z")

</div>

The documentation doesn’t mention where to configure the redirect uri on the github example. The SDK version is the same as it’s on the github example. The only changes I’ve made to the example is adding my web3auth client id, cognito client\_id and the domain. I’m using google for oauth if that makes a difference.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [August 14, 2025, 12:11pm UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/4 "2025-08-14T12:11:07Z")

</div>

Hey @Aniket-Bhat

We might have to check a few things. Can you please join the office hours happening today for dedicated support: [Web3Auth Developer Office Hours](https://web3auth.io/community/t/web3auth-developer-office-hours/8777)

---

<div class="post-metadata">

**Author:** ![Aniket-Bhat](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@Aniket-Bhat](https://builder.metamask.io/u/Aniket-Bhat)\
**Post date:** [August 18, 2025, 9:18am UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/5 "2025-08-18T09:18:05Z")

</div>

Hi @maharshi

Sorry didn’t see this in time. Is there anyway this can be looked into before the next office hours? FWIW, the cognito example doesn’t work out of the box as is either. Something about invalid credentials so idk where I’m going wrong.

On a sidenote, I noticed that the unity sdk is still at v5. Is it just inconsistent versions between frameworks, or is the unity sdk at EOL/getting future updates/a lower priority?

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [August 29, 2025, 6:42am UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/6 "2025-08-29T06:42:05Z")

</div>

Hey @Aniket-Bhat  
I have just merged the branch that fixes the cognito example to work right out of the box. So please have a look and let me know.

---

<div class="post-metadata">

**Author:** ![Aniket-Bhat](https://avatars.discourse-cdn.com/v4/letter/a/7bcc69/32.png) [@Aniket-Bhat](https://builder.metamask.io/u/Aniket-Bhat)\
**Post date:** [September 3, 2025, 1:00pm UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/7 "2025-09-03T13:00:57Z")

</div>

Hi @maharshi

Yep, I can confirm that the example works out of the box, however what’s odd is when I try to run it with my inputs, the popup works fine, it shows me my cognito login page, and then the flow works perfectly till I see a web3auth spinner back again. However it closes and nothing happens.

I can see that as soon as my cognito login page opens, and in the console it just says “Web wallet was closed by user” when I didn’t do anyhting. I’m guessing that’s why it can’t seem to connect after the whole flow is done.

---

<div class="post-metadata">

**Author:** ![maharshi](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/maharshi/32/1525_2.png) [@maharshi](https://builder.metamask.io/u/maharshi)\
**Post date:** [September 9, 2025, 7:13am UTC](https://builder.metamask.io/t/aws-congito-redirect-mismatch/956/8 "2025-09-09T07:13:30Z")

</div>

Did you check that the correct redirects are whitelisted on the cognito side?
