-I am using the Web3Auth SDK Version 2.1.1 and Unity Version 2022.3.18f1
-The code works fine without error on Android platform mode in Unity editor.
-When the script opens a tab in browser to login, I go through the process and return to the app. The code does not register that the login has occurred/succeeded.
When I test in-app on my iPhone with a build, I get this error:
There seems to be some bug in the code. Please contact support to fix this.
could not validate redirect, please whitelist your domain: <Domain> for provided clientId <clientID> at https://dashboard.web3auth.io. Also, this project is on testnet network. Please ensure the the used Client ID belongs to this network.
The Unity example works fine for me when the build platform is not set to iOS. When it is set to iOS, the same EntryPointNotFoundException error appears on start, and logging in does not work. The browser opens and I go through the verification code but nothing happens in-app. (This was all tested in Unity Editor, if you believe I should also try it in an iOS build, I will.)
Because I am just using testnet, the dashboard will not allow me to whitelist any domain. Should I switch from testnet? I was just trying to verify that Web3Auth in it’s most basic form will even work for my app.
Any update on this? I’m working on other parts of my project in the meantime but if there are any troubleshooting steps I should take for this, let me know.
I hope you are doing well. I will try to help you so you can solve the problem as soon as possible.
"Because I am just using testnet, the dashboard will not allow me to whitelist any domain. " Please tellm me which environment are you using ? I can add a whitelist item into testnet and also devnet_sapphire.
Thank you for your reply,
I am currently using sapphire_devnet
I tried again to whitelist the domain as it appeared in the “please whitelist” error message from my original post.
It gave me a “Fail to whitelist the domain” error message.
I did make another test project, this time on the legacy testnet and was able to add the domain without issue, so I tried again to add the domain on my project that is using sapphire devnet.
The whitelist was successful this time (frustrating as I verified I took the same steps as before).
However, when I tested a authentication call in Unity (iOS build platform), I received the same error in console as before.
I will be performing a test of this in a iOS build today and will reply with an update when I do.
I hope everything’s going great. Could you please double-check if you’re using sapphire_devnet in your project and share the configuration code? Also, it’s crucial to make sure that the Client_Id you’re using refers to the same network. Based on some screenshots, there seems to be a mix-up there.
I may be being obtuse but I’m not sure what you’re referring to when you say “configuration code”. Here is the code I set up for testing following the Unity guide. Hopefully this is what you are looking for.
using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using Newtonsoft.Json;
public class Web3AuthTest : MonoBehaviour
{
public Web3Auth web3Auth;
public TextMeshProUGUI text;
public enum providerenum
{
GOOGLE,
FACEBOOK,
REDDIT,
DISCORD,
TWITCH,
APPLE,
LINE,
GITHUB,
KAKAO,
LINKEDIN,
TWITTER,
WEIBO,
WECHAT,
EMAIL_PASSWORDLESS,
EMAIL_PASSWORD,
JWT,
CUSTOM_VERIFIER
}
public Provider providerchoice;
void Start()
{
web3Auth = GetComponent<Web3Auth>();
web3Auth.setOptions(new Web3AuthOptions()
{
redirectUrl = new Uri("https://com.Near8.Noded://auth"),
clientId = "<My Client_ID>", //this seems to be the same as the client ID I have everywhere else.
network = Web3Auth.Network.SAPPHIRE_DEVNET,
});
web3Auth.onLogin += onLogin;
web3Auth.onLogout += onLogout;
}
public void login()
{
var selectedProvider = providerchoice;
var options = new LoginParams()
{
loginProvider = selectedProvider
};
web3Auth.login(options);
}
private void onLogin(Web3AuthResponse response)
{
var userInfo = JsonConvert.SerializeObject(response.userInfo, Formatting.Indented);
Debug.Log(userInfo);
text.text = userInfo;
}
public void logout()
{
web3Auth.logout();
}
private void onLogout()
{
Debug.Log("Logged out!");
}
}
I am new to a lot of this as I am primarily a Unity dev who doesn’t often work with 3rd party integrations, so there is a chance I am missing something obvious. Hope we can figure this out together + prevent it from happening to others.
Thanks for the reply. I’ve checked my redirect URL again and it seems to be correct. If you’re seeing something wrong with it that I am not seeing, please let me know.
Could you clarify what you mean by this? I understand that it should be in Start(), but in what script? (I assume the Web3AuthTest script I sent?)
What are the variables there? Is rpcURL supposed to be the redirect URL?
Ah ok. Yes this is from the example.
Just checked the example again and it has the right code that you provided. (web3 = new Web3(rpcURL);)
When I run the example in Unity with iOS build as the build platform, I get the same error that I always get in my actual project.
Then, if I go ahead and enter my email, go through the email verification in browser, and go back to Unity, there is no success state with the login information.
I tested the example again with Android as the build platform and it worked fine.