# \[Archive\] \[error\] "could not validate redirect, ~~~ "

**URL:** <https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902>\
**Category:** Embedded Wallets (Web3Auth)\
**Created:** [May 25, 2023, 2:06am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902 "2023-05-25T02:06:22Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 25, 2023, 2:06am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/1 "2023-05-25T02:06:22Z")

</div>

> **🏛 Archived Content from Web3Auth Community**
> 
> This topic was originally posted by **jh\_kim** on 5/25/2023.  
> This content has been migrated from our previous community forum to preserve valuable discussions.

* * *

**Please provide the following details too when asking for help in this category:**  
Please check the issue below, even if I set valid clientId into the source and also add IP address  
with port into dashboard in our team, below error is not fixed.

- SDK Version: 33

- Expo or Bare Version:

- Screenshots of error:  

- Related to Custom Authentication? Please provide the following info too: **(Optional)**

FYI, react-native: 0.71.8  
**Please provide the Web3Auth initialization and login code snippet below:**

# Source from example you provided

const login = async () =\> {  
try {  
setConsole(‘Logging in’);  
setConsole(clientId);  
const web3auth = new Web3Auth(WebBrowser, {  
clientId,  
network: OPENLOGIN\_NETWORK.TESTNET,  
});  
const info: any = await web3auth.login({  
loginProvider: LOGIN\_PROVIDER.GOOGLE,  
redirectUrl: resolvedRedirectUrl,  
mfaLevel: ‘default’,  
curve: ‘secp256k1’,  
});  
uiConsole(info);  
setUserInfo(info);  
setKey(info.privKey);  
uiConsole(‘Logged In’);  
} catch (e: any) {  
uiConsole(e);  
}  
};

---

<div class="post-metadata">

**Author:** ![vjgee](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vjgee](https://builder.metamask.io/u/vjgee)\
**Post date:** [May 25, 2023, 2:52am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/2 "2023-05-25T02:52:01Z")

</div>

Hey @jh_kim ,

First thing is to create a Plug and play project for testnet. Then you have to create a project for mainnet **using the same project name!**

[![209103312-01310042-72f0-41da-8cba-8c739f34a001](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/0/02b30687cd6f35226795c9a78169dee668d854b1.png)
209103312-01310042-72f0-41da-8cba-8c739f34a0012558×1242 90.6 KB
](https://community.web3auth.io/community/community/uploads/default/original/1X/e6bebea2f7db56d93602a9b0220a5715a4e66c91.png "209103312-01310042-72f0-41da-8cba-8c739f34a001")

Then, inside this new project for mainnet you should add a whiltelisted URL

[![209103886-f24baf75-c155-43b7-aa5c-1871df6f9690](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/b/b6edb4e8ec07f934a2d11cf4fcc88e768854d4f8.png)
209103886-f24baf75-c155-43b7-aa5c-1871df6f96902288×1166 134 KB
](https://community.web3auth.io/community/community/uploads/default/original/1X/6aa57e925144952a9082190a20a5f012011d2921.png "209103886-f24baf75-c155-43b7-aa5c-1871df6f9690")

Dont forget to use the clientId from your **Mainnet project**

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 25, 2023, 5:56am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/3 "2023-05-25T05:56:48Z")

</div>

> [@jh\_kim](#):
>
> network: OPENLOGIN\_NETWORK.TESTNET,

hi, vjgee,

I have set as “testnet” in the source but I should set the mainnet with “clientId” for mainset, not testnet?  
Also, should I create the mainnet as well for testnet?

Below is the sample.  
const web3auth = new Web3Auth(WebBrowser, {  
clientId,  
network: OPENLOGIN\_NETWORK.TESTNET,  
});

Best regards,

---

<div class="post-metadata">

**Author:** ![vjgee](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vjgee](https://builder.metamask.io/u/vjgee)\
**Post date:** [May 25, 2023, 6:12am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/4 "2023-05-25T06:12:59Z")

</div>

Can you try adding this parameter below to your code ?:

**web3AuthNetwork: ‘testnet’** instead of network: OPENLOGIN\_NETWORK.TESTNET,

Sample code below:

```auto
const web3Auth = new Web3Auth({
    clientId,
    chainConfig: {
      chainNamespace: 'eip155',
      chainId: '0x13881', // hex of 80001, polygon testnet
      rpcTarget: MUMBAI_PROVIDER_URL,
      displayName: 'Polygon Testnet',
      blockExplorer: 'https://mumbai.polygonscan.com/',
      ticker: 'MATIC',
      tickerName: 'Matic',
    },
    uiConfig: {
      theme: 'light',
    },
    web3AuthNetwork: 'testnet', // Add this line
  });

```

Ideally, you should create the same project on mainnet after testnet, whitelist on mainnet and use its clientId.

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 25, 2023, 8:16am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/5 "2023-05-25T08:16:41Z")

</div>

Hi,

same error, FYI, I used below.

const web3auth = new Web3Auth(WebBrowser, {  
clientId,  
chainConfig: {  
chainNamespace: ‘eip155’,  
chainId: ‘0x13881’, // hex of 80001, polygon testnet  
rpcTarget: ‘[https://rpc.ankr.com/polygon\_mumbai](https://rpc.ankr.com/polygon_mumbai)’,  
displayName: ‘polygon Testnet’,  
blockExplorer: ‘[https://mumbai.polygonscan.com/](https://mumbai.polygonscan.com/)’,  
ticker: ‘MATIC’,  
tickerName: ‘Matic’,  
},  
web3AuthNetwork: ‘testnet’,  
});  
const info: any = await web3auth.login({  
loginProvider: LOGIN\_PROVIDER.GOOGLE,  
redirectUrl: resolvedRedirectUrl,  
// mfaLevel: ‘default’,  
// curve: ‘secp256k1’,  
});

---

<div class="post-metadata">

**Author:** ![vjgee](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vjgee](https://builder.metamask.io/u/vjgee)\
**Post date:** [May 25, 2023, 8:35am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/6 "2023-05-25T08:35:29Z")

</div>

Please create the project for mainnet **using the same project name!** , inside this new project for mainnet you should add a whiltelisted URL and use the clientID from your **Mainnet project**

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 25, 2023, 9:02am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/7 "2023-05-25T09:02:02Z")

</div>

Please check below issue, even if I set testnet first already, the error was occured when create the “Mainnet”.

[![main](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/4/43d3a8c967224eff9b4aa9ee1a4fcb569976fd5f.png)
main721×777 35.8 KB
](https://community.web3auth.io/community/community/uploads/default/original/1X/7748ea7b6daaa330ab80d6cd6bded9a7901ead31.png "main")

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 30, 2023, 1:26am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/8 "2023-05-30T01:26:34Z")

</div>

Hi,

[![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/5/5032929781188a8b7a7fc6191788d52bf678aa46.png)
image1253×447 25.9 KB
](https://community.web3auth.io/community/community/uploads/default/original/1X/73da65bd99104f82d17419bc3ddb8f740483abbf.png "image")
  
Even, I added the mainnet as your guide, the error is not fixed yet.  
Can we have a quick meeting via google meet?

[![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/b/b2e8d3a47365c93866f8e613c592a5eeb2a9181f.png)
image581×1085 122 KB
](https://community.web3auth.io/community/community/uploads/default/original/1X/372f8ec1402ecaefecb1143e6bdf3dc246e167fa.png "image")

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [May 30, 2023, 4:25am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/9 "2023-05-30T04:25:13Z")

</div>

Hey @jh_kim

Could you share your project’s client id?

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 30, 2023, 4:42am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/10 "2023-05-30T04:42:03Z")

</div>

I created new clinetId for this test as below and it shows the same issue in testnet and mainnet.  
below client id is for testnet.

BEovfWozLXxCIgnWAb2KiCyx8Q4XXq7Ml2gt\_jNcoQ3jkZfCckejOi6yxNOJiP4laHbnZpZPUc0DpPGOlZL6PL4

also, please let me know about the “scheme” which name should be set.

const resolvedRedirectUrl = `${scheme}://openlogin`;

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [May 30, 2023, 5:27am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/11 "2023-05-30T05:27:18Z")

</div>

For Android build, it should be `scheme` defined in your `AndroidManifest.xml`. Check out [Installing PnP React Native SDK | Documentation](https://web3auth.io/docs/sdk/pnp/react-native/install#android)

For iOS build, you don’t need to add `redirectUrl`.

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 31, 2023, 1:21am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/12 "2023-05-31T01:21:29Z")

</div>

I already set the initiall code by following web3auth site and the page also was already added into my code.  
But, as I mentioned at the first inquery, it is still not working.

So, please let me know if it is any issue to have a quick meeting via google meet.

 ![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/7/7882f217d13f7f5a660883c80852b61d70893b8f.png)  
 ![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/6/63ac9416ad2a986e0625c6c42d8a78e4eeb34bb9.png)

[![image](https://canada1.discourse-cdn.com/flex011/uploads/metamaskbuilderhub/original/2X/b/bfac6b846807b093433b6c8e7fe33c386e5c250c.png)
image521×1057 87.2 KB
](https://community.web3auth.io/community/community/uploads/default/original/1X/5460b377d5a96fb79e6539a56993f763e48525ea.png "image")

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [May 31, 2023, 9:13am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/13 "2023-05-31T09:13:13Z")

</div>

I still wonder why your team cannot find the reason not to login for this case.  
Below error site is your page, please kindly check the log or reason to do proper action.

[https://sdk.openlogin.com/login#eyJpbml0Ijp7ImNsaWVudElkIjoiQkVvdmZXb3pMWHhDSWduV0FiMktpQ3l4OFE0WFhxN01sMmd0X2pOY29RM2prWmZDY2tlak9pNnl4Tk9KaVA0bGFIYm5acFpQVWMwRHBQR09sWkw2UEw0IiwibmV0d29yayI6InRlc3RuZXQiLCJzZGtVcmwiOiJodHRwczovL3Nkay5vcGVubG9naW4uY29tIn0sInBhcmFtcyI6eyJsb2dpblByb3ZpZGVyIjoiZ29vZ2xlIiwicmVkaXJlY3RVcmwiOiJwdXpsX3B1YmxpY19hcHA6Ly9vcGVubG9naW4iLCJtZmFMZXZlbCI6ImRlZmF1bHQiLCJjdXJ2ZSI6InNlY3AyNTZrMSJ9fQ](https://sdk.openlogin.com/login#eyJpbml0Ijp7ImNsaWVudElkIjoiQkVvdmZXb3pMWHhDSWduV0FiMktpQ3l4OFE0WFhxN01sMmd0X2pOY29RM2prWmZDY2tlak9pNnl4Tk9KaVA0bGFIYm5acFpQVWMwRHBQR09sWkw2UEw0IiwibmV0d29yayI6InRlc3RuZXQiLCJzZGtVcmwiOiJodHRwczovL3Nkay5vcGVubG9naW4uY29tIn0sInBhcmFtcyI6eyJsb2dpblByb3ZpZGVyIjoiZ29vZ2xlIiwicmVkaXJlY3RVcmwiOiJwdXpsX3B1YmxpY19hcHA6Ly9vcGVubG9naW4iLCJtZmFMZXZlbCI6ImRlZmF1bHQiLCJjdXJ2ZSI6InNlY3AyNTZrMSJ9fQ)

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [June 1, 2023, 3:38am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/14 "2023-06-01T03:38:23Z")

</div>

> [@jh\_kim](#):
>
> please let me know if it is any issue to have a quick meeting via google meet.

Hello @jh_kim,

I am happy to assist you with your concern. Let’s schedule a call to address the issue. Kindly expect an email from me, sent to the same email address you used in this community forum.

---

<div class="post-metadata">

**Author:** ![jh\_kim](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jh\_kim](https://builder.metamask.io/u/jh_kim)\
**Post date:** [June 1, 2023, 4:25am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/15 "2023-06-01T04:25:40Z")

</div>

Thank you for your kind comment.  
With your link, I arrange the meeting date on 5th June.

Please kindly chekc the schedule and hope to meet you on that day.

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [June 5, 2023, 5:20am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/16 "2023-06-05T05:20:25Z")

</div>

The issue has been resolved successfully.

The problem was related to adding `{scheme}://openlogin` to the whitelist section of the project. Please note that the scheme should not contain any underscores, such as “test\_app”.

---

<div class="post-metadata">

**Author:** ![spapinwar](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@spapinwar](https://builder.metamask.io/u/spapinwar)\
**Post date:** [June 28, 2023, 10:01am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/17 "2023-06-28T10:01:50Z")

</div>

@shahbaz I have added the correct schema and it does not contain any white spaces, and works fine on iOS.

The problem I am having is with android (trying google login) when I click on login after logging in it gives a button to go back to the app which does not work, can you help?

---

<div class="post-metadata">

**Author:** ![shahbaz](https://yyz1.discourse-cdn.com/flex011/user_avatar/builder.metamask.io/shahbaz/32/1527_2.png) [@shahbaz](https://builder.metamask.io/u/shahbaz)\
**Post date:** [July 4, 2023, 8:01am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/18 "2023-07-04T08:01:36Z")

</div>

Hello @spapinwar,

May I know if you are using bare or expo flow? Also, have you followed the steps mentioned in [Installing PnP React Native SDK | Documentation | Web3Auth](https://web3auth.io/docs/sdk/pnp/react-native/install#bare-react-native-workflow-1)?

To better assist you, it would be helpful if you create a separate thread with code snippets, error messages, and logs. This will help in monitoring new threads and resolving the issue efficiently.

---

<div class="post-metadata">

**Author:** ![spapinwar](https://avatars.discourse-cdn.com/v4/letter/s/22d042/32.png) [@spapinwar](https://builder.metamask.io/u/spapinwar)\
**Post date:** [July 6, 2023, 9:15am UTC](https://builder.metamask.io/t/archive-error-could-not-validate-redirect/1902/19 "2023-07-06T09:15:47Z")

</div>

Hey @shahbaz,

I have made a new topic - [Redirect to app not working after successful google login on android](https://community.web3auth.io/t/redirect-to-app-not-working-after-successful-google-login-on-android/4744)

We have gone through the documentation and have followed all the steps, we also took help from you examples and firebase-bare-app folder.
