private IAuthClient CreateAuthClient() { #if !UNITY_WEBGL try { CertValidationBypass.Enable(); return(AuthClientFactory.Configure() .WithLogger(Debug.unityLogger) .WithClientId("25pDQvX4O5j7wgwT052Sh3UzXVR9X6Ud") // unity3d sdk .WithDomain("loomx.auth0.com") .WithScheme("io.loomx.unity3d") .WithAudience("https://keystore.loomx.io/") .WithScope("openid profile email picture") .WithRedirectUrl("http://127.0.0.1:9998/auth/auth0/") .Create()); } finally { CertValidationBypass.Disable(); } #else return(AuthClientFactory.Configure() .WithLogger(Debug.unityLogger) .WithHostPageHandlers(new Loom.Unity3d.WebGL.HostPageHandlers { SignIn = "authenticateFromGame", GetUserInfo = "getUserInfo", SignOut = "clearUserInfo" }) .Create()); #endif }
public async void SignIn() { try { CertValidationBypass.Enable(); var authClient = AuthClientFactory.Configure() .WithLogger(Debug.unityLogger) .WithClientId("25pDQvX4O5j7wgwT052Sh3UzXVR9X6Ud") // unity3d sdk .WithDomain("loomx.auth0.com") .WithScheme("io.loomx.unity3d") .WithAudience("https://keystore.loomx.io/") .WithScope("openid profile email picture") .WithRedirectUrl("http://127.0.0.1:9999/auth/auth0/") .Create(); var accessToken = await authClient.GetAccessTokenAsync(); var keyStore = await KeyStoreFactory.CreateVaultStore(new VaultStoreConfig { Url = "https://stage-vault.delegatecall.com/v1/", VaultPrefix = "unity3d-sdk", AccessToken = accessToken }); this.identity = await authClient.GetIdentityAsync(accessToken, keyStore); } finally { CertValidationBypass.Disable(); } this.statusTextRef.text = "Signed in as " + this.identity.Username; // This DAppChain client will connect to the example REST server in the Loom Go SDK. this.chainClient = new DAppChainClient("http://localhost", 46657, 47000) { Logger = Debug.unityLogger }; this.chainClient.TxMiddleware = new TxMiddleware(new ITxMiddlewareHandler[] { new NonceTxMiddleware { PublicKey = this.identity.PublicKey, Client = this.chainClient }, new SignedTxMiddleware(this.identity.PrivateKey) }); this.callerAddr = this.identity.ToAddress("default"); }