generateToken
Used for generating a new Bearer
token, if enabled. By default, this method will automatically updates the auth
property. Learn more about Cobalt sessions.
ts
generateToken(turnstileResponse: string, updateAuth = true): Promise<CobaltSession | CobaltError>
Parameters:
Name | Type | Description |
---|---|---|
turnstileResponse | string | Cloudflare Turnstile response |
updateAuth default: true | boolean | Wether it updates the auth property |
Returns: Promise<
CobaltSession
|
CobaltError
>
Example:
ts
let res = await cobalt.generateToken(turnstileResponse);
if(res.status == 'success') console.log(res.token);