getToken
codebolt.tokenizer.getToken(key: string): Promise<GetTokenResponse>
Retrieves a token from the system via WebSocket.
Parameters
Name | Type | Description |
---|---|---|
key | string | The key associated with the token to be retrieved. |
Returns:
Promise<GetTokenResponse>
A promise that resolves with the response from the get token event.Example
import codebolt from '@codebolt/codeboltjs';
async function exampleGetToken() {
try {
const response = await codebolt.tokenizer.getToken("myTokenKey");
console.log("Token retrieved successfully:", response);
catch (error) {
console.error("Failed to retrieve token:", error);
}
}
}