chris-kode / myanimelist-api-v2 Goto Github PK
View Code? Open in Web Editor NEWAn awesome wrapper on Nodejs for the new MyAnimeList's API v2!
License: MIT License
An awesome wrapper on Nodejs for the new MyAnimeList's API v2!
License: MIT License
The MyAnimeList API now supports authentication using only the client ID.
See https://myanimelist.net/forum/?topicid=1973077&show=0#msg64957586
By default, if no season is inputted, it'll default to the current season. However there are 2 issues with how you're getting the current season:
season = this.utils.getSeasonForNumberMonth(new Date().getMonth()+1)
switch (true)
or better yet use if/else. More info: https://stackoverflow.com/a/2312837/15238307I can make these fixes and open a PR within the week, but just wanted to document the issues first.
Hey, I'm pretty new to authentication and only have experience using Passport.js to log in with OAuth 2.0. I'm having trouble understanding where everything goes and figuring out how to apply my knowledge of Passport here.
I'm using express like in your examples and have set up a route for "/auth/mal" and "/auth/mal/callback". I'm successfully accessing the Authorization Dialog page and then the callback route.
Am I correct in thinking that this is where my oauth.accessToken(pkce.code_verifier, pkce.code_challenge)... function should go and that those are the correct parameters? When I put this function in my callback route, I get the following error every time MAL redirects to my callback route:
{"error":"invalid_request","message":"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.","hint":"Cannot decrypt the authorization code"}
Would really appreciate some help with this. Thanks!
Is it possible to get an api endpoint for user's history?
Something like:
/users/{user_name}/history - full
/users/{user_name}/history/anime - anime only
/users/{user_name}/history/manga - manga only
when mal redirects it says
"file not found"
Following the example on the README, in step two, I got it like this:
this.code = this.$route.query.code; // After allowing MAL it redirects to the page you set as redirect uri with the parameter 'code'.
const oauth = new API.OAUTH(process.env.CLIENT_ID, process.env.CLIENT_SECRET);
oauth
.accessToken(this.code, process.env.CODE_CHALLENGE)
.then((response) => {
console.log(response);
})
.catch((err) => {
console.log(err);
});
Which gives the following error:
{
error: 'invalid_grant',
message: 'The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.',
hint: 'Failed to verify `code_verifier`.'
}
As the hint says, the code_verifier is not valid, and that's because we're passing CODE_CHALLENGE(#4 ), I tried replacing it with the CODE_VERIFIER value, but still get the same error.
Reading the file Mal_Oauth.js, I can see that the intended parameter was indeed code_verifier but again, it's not working for me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.