SMS login on React Native on Android gives Invalid authentication url error

I try to implement SMS login on Android using react native SDK(@web3auth/react-native-sdk v5.1.0).

await web3auth.login({
    	loginProvider,
    	redirectUrl: resolvedRedirectUrl,
});

when the above code is called, the browser opens and display the following error:

Invalid authentication url
Url contains invalid params

The url looks like below

https://passwordless.web3auth.io/v3/authorize?state=eyJjbGllbnQiOiJCUFo0bTZwMWZOMUlNcEhjRUQ2Sks1NGtBbHFGSXFUakV2RVdySm1oX0lwOUlUUVFCYkxWbDU1ajlVU2J5R050S3JkUW1GQ1FqaHFUQ1VkRlBhMTU0QmsiLCJjdXJyZW50TG9naW5Qcm92aWRlciI6InNtc19wYXNzd29yZGxlc3MiLCJwb3B1cFdpbmRvdyI6ImZhbHNlIiwid2hpdGVMYWJlbCI6Int9Iiwia2V5TW9kZSI6InYxIiwiaXNDdXN0b21WZXJpZmllciI6ImZhbHNlIiwic29jaWFsRmFjdG9yRmxvdyI6IiIsImxvZ2luSWQiOiJiZjU5NzVhYTM3MDkzOWI5NzFkNDIyMmVlZGYzZThmM2UxZThjYjVmNTY3YjAwOWMyOWU0OTZiMDVkYWJlZmEwIiwic2Vzc2lvbk5hbWVzcGFjZSI6IiIsInZlcnNpb24iOiI2IiwiaW5zdGFuY2VJZCI6IjBtMDhwN2Nub3ZmIiwidmVyaWZpZXIiOiJ3ZWIzYXV0aCIsInR5cGVPZkxvZ2luIjoiand0IiwicmVkaXJlY3RUb09wZW5lciI6ZmFsc2V9&response_type=token+id_token&client_id=4jK24VpfepWRSe5EMdd2if0RBD55pAuA&prompt=login&redirect_uri=https%3A%2F%2Fauth.web3auth.io%2Fauth&scope=openid+profile+email&connection=sms&nonce=0m08p7cnovf&verifierIdField=name&network=sapphire_devnet

I am able to login with gmail, so the parameters for web3auth SDK should have been correctly configured already.
What would be the problem for SMS login?

@xingxiaoxiong Welcome Aboard!

Can you share your implementation code? You can take a look at our examples for React Native SDK :

This time I tried with the official example project but still the same issue: I am able to login via gmail, but failed with sms

I created my project by running the following command
npx degit Web3Auth/web3auth-pnp-examples/react-native/rn-bare-quick-start rn-bare-quick-start

(in order to build this project, I have to put
packagingOptions {
pickFirst ‘/libcrypto.so’
pickFirst '
/libssl.so’
}
in android/app/build.gradle)

I replaced the cliendId with my own, and used the following code to create a Web3Auth instance:

const web3auth = new Web3Auth(WebBrowser, EncryptedStorage, {
  clientId,
  network: OPENLOGIN_NETWORK.SAPPHIRE_DEVNET, // or other networks
});

(I am on the DEVNET)

When I am testing with google login, I use

await web3auth.login({
    loginProvider: LOGIN_PROVIDER.GOOGLE,
    redirectUrl: resolvedRedirectUrl,
});

When I am testing with SMS login, I use

await web3auth.login({
    loginProvider: LOGIN_PROVIDER.SMS_PASSWORDLESS,
    redirectUrl: resolvedRedirectUrl,
});

Google login works successfully, but when I try to login with SMS, the browser opens and then displays

Invalid authentication url
Url contains invalid params

I have turned on SMS OTP on the Add-Ons Tabe on my project’s dashboard.

1 Like

Are you using the latest Openlogin Adapter version 7.2.0

What is number you are verifying for SMS? SMS login is supported only for the following countries:

  "United Arab Emirates",
  "Argentina",
  "Austria",
  "Australia",
  "Belgium",
  "Brazil",
  "Canada",
  "Switzerland",
  "China",
  "Colombia",
  "Czech Republic",
  "Germany",
  "Denmark",
  "Spain",
  "Finland",
  "France",
  "United Kingdom",
  "Hong Kong",
  "Croatia",
  "Indonesia",
  "Ireland",
  "Israel",
  "India",
  "Italy",
  "Japan",
  "Korea, Republic of South Korea",
  "Luxembourg",
  "Myanmar",
  "Malta",
  "Mauritius",
  "Malaysia",
  "Netherlands",
  "Norway",
  "New Zealand",
  "Philippines",
  "Poland",
  "Portugal",
  "Russia",
  "Saudi Arabia",
  "Sweden",
  "Singapore",
  "Thailand",
  "Turkey",
  "Ukraine",
  "United States",
  "Vietnam",
  "South Africa",
  "Zimbabwe",

openlogin-adapter is not listed in the package.json of the official example project. ( Web3Auth/web3auth-pnp-examples/react-native/rn-bare-quick-start)

I am located in Japan and using a Japanese phone number, so it is supported. The problem is that errors occurs before I can see the page for entering the phone number.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.