Official MyAnimeList API
Import:
import { Mal } from "node-myanimelist";
Initialize api (Auth)
const auth = Mal.auth("app_id")
Use initialized api (Auth) to login:
const acount = await auth.Unstable.login("username","password");
pkce-challenge
import pkceChallenge from "pkce-challenge";const pkce = pkceChallenge();
const url = auth.getOAuthUrl(pkce.code_challenge);
const acount = await auth.authorizeWithCode(code, code_challenge)
You probably want to save acount somewhere, you can just call acount.stringifyToken() to get json
acount.stringifyToken()
Later you can load it using:
const token = Mal.MalToken.fromJsonString(jsonStr);const acount = auth.loadToken(token);
If more time has passed you can also refresh token instead of loading last one
const acount = await auth.authorizeWithRefreshToken(json.refresh_token);
Finally you can use MalAcount
let search = await acount.manga.search( "Sakurasou", Mal.Manga.fields().all()).call();
Generated using TypeDoc
MalAPI
Official MyAnimeList API
Import:
Initialize api (Auth)
Use initialized api (Auth) to login:
pkce-challenge
npm package is used)You probably want to save acount somewhere, you can just call
acount.stringifyToken()
to get jsonLater you can load it using:
If more time has passed you can also refresh token instead of loading last one
Finally you can use MalAcount