Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tryAuth() {
if (this.connected_ && this.authToken_) {
const token = this.authToken_;
const authMethod = isValidFormat(token) ? 'auth' : 'gauth';
const requestData: { [k: string]: any } = { cred: token };
if (this.authOverride_ === null) {
requestData['noauth'] = true;
} else if (typeof this.authOverride_ === 'object') {
requestData['authvar'] = this.authOverride_;
}
this.sendRequest(authMethod, requestData, (res: { [k: string]: any }) => {
const status: string = res[/*status*/ 's'];
const data: string = res[/*data*/ 'd'] || 'error';
if (this.authToken_ === token) {
if (status === 'ok') {
this.invalidAuthTokenCount_ = 0;
} else {
// Triggers reconnect and force refresh for auth token
this.onAuthRevoked_(status, data);
tryAuth() {
if (this.connected_ && this.authToken_) {
const token = this.authToken_;
const authMethod = isValidFormat(token) ? 'auth' : 'gauth';
const requestData: { [k: string]: unknown } = { cred: token };
if (this.authOverride_ === null) {
requestData['noauth'] = true;
} else if (typeof this.authOverride_ === 'object') {
requestData['authvar'] = this.authOverride_;
}
this.sendRequest(
authMethod,
requestData,
(res: { [k: string]: unknown }) => {
const status = res[/*status*/ 's'] as string;
const data = (res[/*data*/ 'd'] as string) || 'error';
if (this.authToken_ === token) {
if (status === 'ok') {
this.invalidAuthTokenCount_ = 0;