#Need help on MAL Auth

1 messages · Page 1 of 1 (latest)

wraith belfryBOT
#

Welcome @reef tartan!

Someone from <@&938443185347244033> will assist when they're available.

Including meta.log from the beginning is a huge help. Type !logs for more information.

After attaching your log, do not forget to hit the green check boxes when prompted by our bot.

#

You can press the "Close Post" button above or type /close at any time to close this post.

wraith belfryBOT
#

The following was shared by @reef tartan and was automatically redacted by Luma as it may have contained sensitive information.

#

Hey, I have an issue that drives me crazy, I can't get kometa authenticate on MAL on mac / docker / windows (WSL) on master branch
Generated config online (https://kometa.wiki/en/latest/config/myanimelist/#online-authorization) seems to work correctly but I cant get it to work in Kometa from a fresh config.yaml

I always have the following Invalid code error :

| Connecting to My Anime List...                                                                     |
| Traceback (most recent call last):                                                                 |
|   File "/home/elio/Kometa/modules/mal.py", line 96, in __init__                                    |
|     self._authorization()                                                                          |
|   File "/home/elio/Kometa/modules/mal.py", line 153, in _authorization                             |
|     raise Failed("MyAnimeList Error: Invalid code")                                                |
| modules.util.Failed: MyAnimeList Error: Invalid code                                               |
|                                                                                                    |
| MyAnimeList Error: Failed to Connect                                                               |
| My Anime List Connection Failed                                                                    |

My config looks like this

mal:
  client_id: (redacted by Luma)
  client_secret: (redacted by Luma)
  cache_expiration: 60
  localhost_url: (redacted by Luma)
  authorization: 
    # authorization section is autofilled by the script
    access_token:
    expires_in:
    refresh_token:
    token_type:

I've tried multiple localhost url generated by kometa but it doesn't seems to work

Thanks

warm laurel
#

you need to click MyAnimeList on the top

reef tartan
#

It redirects on the first tab after auth

#

you can see the begining of MALAUTH at the end of the screenshot

#

What I can't get to work is the authentication in kometa itself

quiet pumice
#

Odd that one works but not the other; they are both the very same code behind the scenes; I just copy-pasted from Kometa for the web-based one.

reef tartan
quiet pumice
#

When I get a chance, sure will.

quiet pumice
#

All three workflows worked fine with one exception; the interactive method didn't wait for me to paste in the localhost URL, so I pasted it in the config file and just ran Kometa a second time which worked as expected.

reef tartan
reef tartan
#

I still can't get it to work wtf
I even created a second app on MAL but still getting an Invalid code.
Here is how I try it :
I fill my mal client_id and client_secret, run kometa
It ask me to go to https://myanimelist.net/v1/oauth2/authorize?response_type=code...
I allow the app, it redirect me on localhost.
I fill the localhost_url: http://localhost/?code=xxx

And then have this

| Connecting to My Anime List...                                                                     |
| Traceback (most recent call last):                                                                 |
|   File "/home/elio/Kometa/modules/mal.py", line 96, in __init__                                    |
|     self._authorization()                                                                          |
|   File "/home/elio/Kometa/modules/mal.py", line 153, in _authorization                             |
|     raise Failed("MyAnimeList Error: Invalid code")                                                |
| modules.util.Failed: MyAnimeList Error: Invalid code                                               |
|                                                                                                    |
| MyAnimeList Error: Failed to Connect                                                               |
| My Anime List Connection Failed                                                                    |

!noredact

#

What's even weirder is that I'm able to make it work through the malauth script on the wiki !noredact

########## GENERATED BY MALAUTH ##########
mal:
  client_id: xxx
  client_secret: xxx
quiet pumice
#

Created a new app:

reef tartan
quiet pumice
#

Did the first workflow where I edited the URL and pasted it into the browser, that gave me a localhost URL which I pasted into the config; ran Kometa again and all filled in.

reef tartan
#

Ok I think it's the url generated by kometa that doesn't work

#

Replacing client_id in this worked !noredact
https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id=CLIENT_ID&code_challenge=k_UHwN_eHAPQVXiceC-rYGkozKqrJmKxPUIUOBIKo1noq_4XGRVCViP_dGcwB-fkPql8f56mmWj5aWCa2HDeugf6sRvnc9Rjhbb1vKGYLY0IwWsDNXRqXdksaVGJthux

quiet pumice
#

Yes, you have to replace CLIENT_ID with your client ID as noted in the wiki.

reef tartan
quiet pumice
#

That just worked for me.

#

With the exception that it didn't wait for me to paste in the URL.

#

I had to paste it in to the config file and run Kometa again.

reef tartan
#

yes same, I need to open it manually

quiet pumice
#

Yes, also as expected.

reef tartan
#

yeah it's not a problem

quiet pumice
#
| Connecting to My Anime List...                                                                     |
| Config Warning: mal sub-attribute cache_expiration is blank using 60 as default                    |
|                                                                                                    |
| Navigate to: https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id=eb6f8650073dd...
|                                                                                                    |
| Login and click the Allow option. You will then be redirected to a localhost                       |
| url that most likely won't load, which is fine. Copy the URL and paste it below                    |
#

I was running this is VS Code, which saw that URL and asked if I wanted to open it, but the display of the URL and then the user having to go there themselves is nothing new. This is the way the interactive thing has always worked.

reef tartan
#

then I paste the localhost url

#

!noredact

mal:
  client_id: 1351xxxx
  client_secret: 1557xxxxx
  cache_expiration: 60
  localhost_url: http://localhost/?code=def5020003xxxxxxx
quiet pumice
#

Seems like an issue on the MAL side, perhaps with the application you've created?

reef tartan
#

I added a logger.debug to see what the error code

quiet pumice
#

Not sure, I can't make it fail so it seems unlikely to be purely a kometa code issue; there must be some environmental component

reef tartan
#

I will try on my mac

quiet pumice
#

Here's the code behind those forms in the wiki if you want to try it totally outside the Kometa context.

#

It's pretty boring and basically cribbed straight from Kometa. Also unchanged since PMM days.

reef tartan
#

I tried to compare with the malauth script in Media-Scripts instead but the auth procedure looks similar

quiet pumice
#

Yeah, it came from there initially

#

moved to its own repo for heroku deploy

reef tartan
#

I don't know what I'm doing wrong for now
I will still try to finish my pr using modified url to generate the localhost url lol

quiet pumice
#

Oh, is this failure in your modified code?

reef tartan
#

I was thinking so at first but went on master branch to check

reef tartan
#

If I replace
code_verifier = secrets.token_urlsafe(100)[:128]
by
code_verifier = uni_code_verifier
It works

#

I don't understand why there is a generation of a new string

reef tartan
#

Basically when the PKCE code_challenge is changed from the 'universal' one, I can't auth

soft ploverBOT
#

chazlarson used !aenh

@reef tartan, anything else needed here? If not, please type /close and hit enter. Please respond within 24 hours of this message or it will be archived.

reef tartan
#

We can close it but issue is still present, when the code_challenge is change from the one from the wiki, weirdly I can't auth

quiet pumice
#

Works fine here; yours is the first report of this I've seen, anyway, and this code is unchanged in a long time.

reef tartan
#

Ok