Skip to main content
Module

x/muse/auth.ts>Authenticator

Youtube Music API (InnerTube) client for Deno, Node and the browser
Go to Latest
class Authenticator
extends EventTarget
import { Authenticator } from "https://deno.land/x/muse@0.0.97/auth.ts";

Authenticates with youtube's API

Constructors

new
Authenticator(options: AuthenticatorOptions)

Properties

_token: Token | null
store: Store
token: Token | null

Methods

get_headers(): Promise<{ Authorization?: string; }>

Get a login code to login via Google Authentiction

Smartly load a token, when you have already loaded one If a token is present, it will check if it is expired

load_token_with_code(login_code: LoginCode, signal?: AbortSignal): Promise<Token>

After getting a login code, get a token

deprecated
load_token_with_code(
code: string,
interval?: number,
signal?: AbortSignal,
): Promise<Token>

Get if the API requires a login

interface Authenticator
implements EventTarget
import { type Authenticator } from "https://deno.land/x/muse@0.0.97/auth.ts";

Methods

addEventListener<K extends keyof AuthenticatorEventMap>(
type: K,
listener: (this: Authenticator, ev: AuthenticatorEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void
addEventListener(
type: string,
options?: boolean | AddEventListenerOptions,
): void
removeEventListener<K extends keyof AuthenticatorEventMap>(
type: K,
listener: (this: Authenticator, ev: AuthenticatorEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void
removeEventListener(
type: string,
options?: boolean | EventListenerOptions,
): void