Forum Settings
Forums

[HELP] oAuth 2.0 Grant Type doesnt accept authorization_code

New
Aug 30, 2022 9:24 AM
#1
Offline
Dec 2018
2
Hello fellas, I try to make oAuth React + Remix Application but every time I request with Axios I got this response both in auth schema 1 and 2;

    data: {
      error: 'unsupported_grant_type',
      message: 'The authorization grant type is not supported by the authorization server.',
      hint: 'Check the `grant_type` parameter'
    }


My full code is;
    axios.post(
        'https://myanimelist.net/v1/oauth2/token', 
        {
            "client_id": process.env.MAL_CLIENT_ID,
            "grant_type": "authorization_code",
            "code": urlCode,
            "code_verifier": pkce_verifier
        },  
        {
            headers: {
                'Authorization': `Basic ${Buffer.from(process.env.MAL_CLIENT_ID+":"+process.env.MAL_CLIENT_SECRET).toString('base64')}`,
                'Content-Type': 'application/x-www-form-urlencoded'
            }
        }
    )
    .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });



I searched for almost two hours but noting find that helps me.
Reply Disabled for Non-Club Members
Aug 30, 2022 10:37 AM
#2
Offline
Dec 2018
2
Solved by using fetch
Mar 14, 2024 1:35 PM
#3
Offline
Jan 2019
1
const response = await axios.post(
'https://myanimelist.net/v1/oauth2/token',
new URLSearchParams({
client_id: process.env.Mal_CLIENT_ID,
grant_type: "authorization_code",
code: authCode,
code_verifier: this.pkce.code_challenge,
client_secret: process.env.Mal_CLIENT_SECRET,
}),
)
Reply Disabled for Non-Club Members

More topics from this board

» I built a spotify-styled 'MyAnimeList Wrapped' for a yearly review of your anime and manga

XAvishkar - Dec 14

1 by Joeliazeers »»
Dec 17, 1:01 PM

» [Repost] list of all relation_type and media_type.

Mr_UnknownOtaku - Dec 8

4 by -DxP- »»
Dec 12, 8:43 AM

» How to get author name?

EdibleMuffin - Feb 12

4 by XAvishkar »»
Dec 8, 9:52 AM

» 401 Unauthorized when doing authorization flow

Konng_ - Nov 16

2 by Konng_ »»
Nov 28, 3:24 PM

» [discontinued] I made a webapp to compare plan-to-watch lists

daux - Apr 16, 2022

33 by daux »»
Oct 2, 4:17 PM
It’s time to ditch the text file.
Keep track of your anime easily by creating your own list.
Sign Up Login