Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function tnsOauthLogin(providerType) {
client = new TnsOAuthClient(providerType);
client.loginWithCompletion((tokenResult: ITnsOAuthTokenResult, error) => {
if (error) {
console.error("back to main page with error: ");
console.error(error);
} else {
console.log("back to main page with access token: ");
console.log(tokenResult);
}
});
}
public tnsOauthLogin(providerType): Promise {
this.client = new TnsOAuthClient(providerType);
return new Promise((resolve, reject) => {
this.client.loginWithCompletion(
(tokenResult: ITnsOAuthTokenResult, error) => {
if (error) {
console.error("back to main page with error: ");
console.error(error);
reject(error);
} else {
console.log("back to main page with access token: ");
console.log(tokenResult);
resolve(tokenResult);
}
}
);
});