/** * Asynchronously request an authentication key based on the provided username and password. When * the request completes onAuthTokenRequestComplete will be fired. This does not need to be called * every time the user wishes to stream. A valid auth token can be saved locally between sessions * and restored by calling SetAuthToken. If a request for a new auth token is made it will * invalidate the previous valid auth token. If successful, this will proceed to log the user in * and will fire OnLoginAttemptComplete with the result. * * @param username The account username * @param password The account password * @return Whether or not the request was made */ public boolean requestAuthToken(String username, String password) { if (getIsIngestTesting() || !m_SdkInitialized) { return false; } logout(); m_UserName = username; AuthParams authParams = new AuthParams(); authParams.userName = username; authParams.password = password; authParams.clientSecret = m_ClientSecret; ErrorCode err = m_Stream.requestAuthToken(authParams); checkError(err); if (ErrorCode.succeeded(err)) { setBroadcastState(BroadcastState.Authenticating); return true; } return false; }