// 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); }
private void advanceToken() { counter++; _currentToken = _generatedTokens[counter]; }
public parserEngine(List <tokenObject> generatedTokens) { _generatedTokens = generatedTokens; _currentToken = _generatedTokens[counter]; }