[error] "could not validate redirect, ~~~ "

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:


    jH6g0s00uY.jpeg)

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

    • Verifier Name:
    • JWKS Endpoint:
    • Sample idToken(JWT)

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);
}
};

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!

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

Dont forget to use the clientId from your Mainnet project

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,

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

web3AuthNetwork: ‘testnet’ instead of network: OPENLOGIN_NETWORK.TESTNET,

Sample code below:

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.

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’,
displayName: ‘polygon Testnet’,
blockExplorer: ‘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’,
});

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

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

Hi,


Even, I added the mainnet as your guide, the error is not fixed yet.
Can we have a quick meeting via google meet?

Hey @jh_kim

Could you share your project’s client id?

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;

For Android build, it should be scheme defined in your AndroidManifest.xml. Check out Installing PnP React Native SDK | Documentation

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

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
image

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

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.

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.

1 Like

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”.

@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?

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?

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.

Hey @shahbaz,

I have made a new topic - Redirect to app not working after successful google login on android

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