示例#1
0
    // Use this for initialization
    IEnumerator Start()
    {
        Debug.Log("Start");
        //Instantiate authToken
        authToken = new tokenObject();

        //User Credentials
        string userCred = "{\"username\":\"[email protected]\", \"password\":\"tenant\"}";

        postHeader.Add("Content-Type", "application/json");

        var userCredBytes = System.Text.Encoding.UTF8.GetBytes(userCred);
        WWW login         = new WWW(url + ":80/api/auth/login", userCredBytes, postHeader);

        yield return(login);

        Debug.Log(login.text);

        authToken = JsonUtility.FromJson <tokenObject> (login.text);

        //Add the Access Token to the Header
        authHeader.Add("X-Authorization", "Bearer " + authToken.token);
        customAPIHeader.Add("token", authToken.token);

        StartCoroutine(getBuildings());
        Invoke("menuStart", 0.5f);
    }
示例#2
0
 private void advanceToken()
 {
     counter++;
     _currentToken = _generatedTokens[counter];
 }
示例#3
0
 public parserEngine(List <tokenObject> generatedTokens)
 {
     _generatedTokens = generatedTokens;
     _currentToken    = _generatedTokens[counter];
 }