I'm having trouble setting up the User Management, I did not have any luck with the User management page when I tried it, when ever I would run the game all the buttons and the text area would show but the text area would not type anything and all the buttons would throw a 401 error "unauthorized client" so I decided to try and change the code my self
using UnityEngine;
using UnityEngine.SocialPlatforms;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System;
using com.shephertz.app42.paas.sdk.csharp;
using com.shephertz.app42.paas.sdk.csharp.user;
using AssemblyCSharp;
public class NewUser : MonoBehaviour
{
Constant cons = new Constant ();
ServiceAPI sp = null;
UserService userService = null; // Initializing User Service.
User createUserObj = null;
public string success, txt_userName, txt_password, txt_emailId, box;
UserResponse callBack = new UserResponse ();
public GUIStyle typeFont;
public GUIStyle labelFont;
public GUIStyle buttonFont;
public GUIStyle errorFont;
float originalWidth = 1024; // Design resoultion
float originalHeight = 768;
#if UNITY_EDITOR
public static bool Validator (object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
{return true;}
#endif
void Start ()
{
#if UNITY_EDITOR
ServicePointManager.ServerCertificateValidationCallback = Validator;
#endif
sp = new ServiceAPI (cons.apiKey,cons.secretKey);
}
void OnGUI ()
{
// Set matrix
Vector2 ratio = new Vector2(Screen.width/originalWidth , Screen.height/originalHeight );
Matrix4x4 guiMatrix = Matrix4x4.identity;
guiMatrix.SetTRS(new Vector3(1, 1, 1), Quaternion.identity, new Vector3(ratio.x, ratio.y, 1));
GUI.matrix = guiMatrix;
GUI.TextArea (new Rect (10, 5, 300, 30), box, errorFont);
if (Time.time % 2 < 1) {
success = callBack.getResult ();
}
// For Setting Up ResponseBox.
GUI.TextArea (new Rect (10, 5, 300, 30), success, errorFont);
GUI.Label (new Rect (10, 60, 100, 30), "E n t e r u s e r n a m e", labelFont);
txt_userName = GUI.TextArea (new Rect (10, 100, 440, 40), txt_userName, typeFont);
GUI.Label (new Rect (10, 160, 100, 30), "E n t e r p a s s w o r d", labelFont);
txt_password = GUI.TextArea (new Rect (10, 200, 440, 40), txt_password, typeFont);
GUI.Label (new Rect (10, 260, 100, 30), "E n t e r e m a i l", labelFont);
txt_emailId = GUI.TextArea (new Rect (10, 300, 440, 40), txt_emailId, typeFont);
string userName = txt_userName;
string password = txt_password;
string emailId = txt_emailId;
//=========================================================================
if (GUI.Button (new Rect (50, 350, 300, 50), "Create User", buttonFont)) {
userService = sp.BuildUserService (); // Initializing UserService.
userService.CreateUser (cons.userName, password, cons.emailId, callBack);
}
// Reset matrix
GUI.matrix = Matrix4x4.identity;
}
}
this code makes three textfields for username, email, and password, i can type things in them but it throw the error email address is in valid what am I doing wrong? any help would be great!