Git Product home page Git Product logo

myanimelist-api-v2's People

Contributors

chris-kode avatar dependabot[bot] avatar farokcode avatar ponsfrilus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

myanimelist-api-v2's Issues

for animeSeasonal, returns incorrect season

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:

  1. Date().getMonth() returns a number 0-11 (dumb, I know). More info: https://stackoverflow.com/questions/18624326/getmonth-in-javascript-gives-previous-month. You need to add a +1 to get the actual month: season = this.utils.getSeasonForNumberMonth(new Date().getMonth()+1)
  2. Switch statements compare the value in the parentheses to the case values. So either put switch (true) or better yet use if/else. More info: https://stackoverflow.com/a/2312837/15238307

I can make these fixes and open a PR within the week, but just wanted to document the issues first.

Redirect

when mal redirects it says
"file not found"

Error requesting access_token

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.

Feature request: history

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

Help with Authorization

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.