Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async loginWithToken() {
try {
let state = await this.client.getClientState();
if (state === Voximplant.ClientState.DISCONNECTED) {
await this.client.connect();
}
if (state !== Voximplant.ClientState.LOGGED_IN) {
const username = await AsyncStorage.getItem('usernameValue');
const accessToken = await AsyncStorage.getItem('accessToken');
console.log('LoginManager: loginWithToken: user: ' + username + ', token: ' + accessToken );
const authResult = await this.client.loginWithToken(username + '.voximplant.com', accessToken);
await this._processLoginSuccess(authResult);
}
} catch (e) {
console.log('LoginManager: loginWithToken: ' + e.name);
if (e.name === Voximplant.ClientEvents.AuthResult) {
console.log('LoginManager: loginWithToken: error code: ' + e.code);
}
}
}
async loginWithToken() {
try {
let state = await this.client.getClientState();
if (state === Voximplant.ClientState.DISCONNECTED) {
await this.client.connect();
}
if (state !== Voximplant.ClientState.LOGGED_IN) {
const username = await AsyncStorage.getItem('usernameValue');
const accessToken = await AsyncStorage.getItem('accessToken');
console.log('LoginManager: loginWithToken: user: ' + username + ', token: ' + accessToken );
const authResult = await this.client.loginWithToken(username + '.voximplant.com', accessToken);
await this._processLoginSuccess(authResult);
}
} catch (e) {
console.log('LoginManager: loginWithToken: ' + e.name);
if (e.name === Voximplant.ClientEvents.AuthResult) {
console.log('LoginManager: loginWithToken: error code: ' + e.code);
}
}
}