Skip to content

Commit

Permalink
reverted my change
Browse files Browse the repository at this point in the history
  • Loading branch information
HeeManSu committed Dec 18, 2024
1 parent 4e6aed7 commit b5567d4
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/cli/validateToken.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { API as APIInterface } from '@metacall/protocol/protocol';
import { unlink } from 'fs/promises';
import { auth } from '../auth';
import { configFilePath, defaultPath, load, save } from '../config';
import { configFilePath, save } from '../config';
import { exists } from '../utils';
import args from './args';
import { error, info } from './messages';
Expand Down Expand Up @@ -33,18 +32,11 @@ const validateToken = async (api: APIInterface): Promise<void> => {

(await exists(configFile)) && (await unlink(configFile));

info('Token expired, initiating token-based login...');
info('Try to login again!');

try {
const config = await load(defaultPath);

const newToken = await auth(config);
// Save the new token
await save({ token: newToken });
return;
} catch (loginErr) {
return error('Token validation failed. Please try again.');
}
return error(
`Token validation failed, potential causes include:\n\t1) The JWT may be mistranslated (Invalid Signature).\n\t2) JWT might have expired.`
);
}
};

Expand Down

0 comments on commit b5567d4

Please sign in to comment.