Skip to content

MyAnimeList Attributes

Configuring MyAnimeList is optional but is required for MyAnimeList based collections and operations to function.

A mal mapping is in the root of the config file.

Below is a mal mapping example and the full set of attributes:

mal:
  client_id: ################################
  client_secret: ################################################################
  localhost_url: 
  authorization:
    access_token:
    token_type:
    expires_in:
    refresh_token:
Attribute Allowed Values Required
client_id MyAnimeList Application Client ID
client_secret MyAnimeList Application Client Secret
localhost_url MyAnimeList Authorization URL

All other attributes will be filled in by Kometa.

To connect to MyAnimeList.net you must create a MyAnimeList application and supply Kometa the client id and client secret provided, please do the following:

  1. Click here to create a MyAnimeList API application.
  2. Enter an App Name for the application. Ex. Kometa
  3. Select web for App Type.
  4. Enter an App Description for the application Ex. Kometa manages metadata and collections
  5. Enter http://localhost/ for App Redirect URL.
  6. Enter https://github.com/Kometa-Team/Kometa for Homepage URL.
  7. Select non-commercial for Commercial / Non-Commercial.
  8. Enter any name under Name / Company Name.
  9. Select hobbyist for Purpose of Use.
  10. Agree to the API License and Developer Agreement and hit the Submit button
  11. You should see Successfully registered. followed by a link that says Return to list click this link.
  12. On this page Click the Edit button next to the application you just created.
  13. Record the Client ID and Client Secret found on the application page.
  14. Go to this URL but replace CLIENT_ID with your Client ID

    https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id=CLIENT_ID&code_challenge=k_UHwN_eHAPQVXiceC-rYGkozKqrJmKxPUIUOBIKo1noq_4XGRVCViP_dGcwB-fkPql8f56mmWj5aWCa2HDeugf6sRvnc9Rjhbb1vKGYLY0IwWsDNXRqXdksaVGJthux
    
  15. You should see a page that looks like this

    MAL Details

  16. Click "Allow"

  17. You will be taken to a page that will not load. That's fine and expected.

    Localhost Failure

  18. Copy the URL, which will be localhost/?code=BLAH and paste in your config file next to localhost_url.

    If you do not see an error as above but instead get taken to some seemingly random website, you probably have a webserver running on your local computer, probably from some sort of tutorial if you don't recall having set one up. For example, some Docker tutorials have you start up local web servers.

    You will need to stop that web server while you're doing this in order to grab that localhost URL.

  19. Run Kometa and the auth will be completed.

Alternative Way of Letting Kometa make the URL

You can record just your client_id and client_secret and Kometa will create the url for you described below.

On the first run, Kometa will walk the user through the OAuth flow by producing a MyAnimeList URL for the user to follow.

After following the URL login to MyAnimeList.net and authorize the application by clicking the Allow button which will redirect the user to http://localhost/.

Copy the entire URL and paste it into Kometa and if the URL is correct then Kometa will populate the authorization sub-attributes to use in subsequent runs.

On first run:

|====================================================================================================|
| Connecting to My Anime List...                                                                     |
|                                                                                                    |
| Navigate to: https://myanimelist.net/v1/oauth2/authorize?response_type=code&client_id=BING&code_challenge=BANG |
|                                                                                                    |
| 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                    |
| URL:

Click on that URL to open your browser to MyAnimeList; you'll be looking at a page like this:

MAL Details

Click "Allow", and you will be taken to a page that will not load. That's fine and expected.

Localhost Failure

Copy the URL, which will be localhost/?code=BLAH and paste it at the prompt.

If you do not see an error as above but instead get taken to some seemingly random website, you probably have a webserver running on your local computer, probably from some sort of tutorial if you don't recall having set one up. For example, some Docker tutorials have you start up local web servers.

You will need to stop that web server while you're doing this in order to grab that localhost URL.

| URL: http://localhost/?code=BOING
| Saving authorization information to /path/to/kometa/config/config.yml |
| My Anime List Connection Successful                                                                |
|====================================================================================================|

OAuth Flow using Docker

To authenticate MyAnimeList the first time, you need run the container with the -it flags in order to walk through the OAuth flow mentioned above. Once you have the MyAnimeList authentication data saved into the YAML, you'll be able to run the container normally.

Online Authorization

When trying to authorize Trakt or MyAnimeList, Kometa needs to run in interactive mode so that you can enter details. This is problematic on some setups [namely docker] where entering interactive mode is not always simple.

These scripts allow you to authorize Trakt and MyAnimeList here on the wiki. Once authorized, the script will give you a YAML block that you will copy into the config.yml, replacing the existing trakt and/or myanimelist sections.

The source code for these scripts can be found on the Trakt-MAL-OAuth Repository.

Usage

  1. Enter client ID and secret.
  2. For Trakt, if you didn't retrieve a PIN yourself less than ten minutes ago, click the button, and enter the PIN in the field.
  3. For MyAnimeList, click the button to authenticate and get the required "localhost URL"
  4. Click "Submit"
  5. Copy and paste the result into your Kometa config.

Running the Authentication Scripts Locally

For users who want full control over the scripts and would prefer the run them locally, you can run the script in docker or python by following the instructions in the Trakt-MAL-OAuth Repository.

Click for instructions on how to run the scripts locally

Ensure you have downloaded a copy of the Trakt-MAL-OAuth Repository. If you have downloaded the ZIP file, extract it to your desired location.

Running in Docker

  1. build the image with docker build -t kometa-auth-image .
  2. run the container with docker run --rm kometa-auth-image
  3. If you get a message complaining that something else is already running on port 5000, run the container with docker run --rm -p 5001:5000 kometa-auth-image
  4. go to http://127.0.0.1:5000 OR http://127.0.0.1:5001.
  5. see instructions above

Running in Python

  1. Make sure you are running a recent Python [this was developed on Python 3.11]
  2. Run these commands to create a virtual environment and install requirements.
    python3 -m venv kometa-auth-venv
    . kometa-auth-venv/bin/activate
    python -m pip install -r requirements.txt
    
  3. run the script with python app.py
  4. If you get a message complaining that something else is already running on port 5000, open app.py and change the 5000 on the last line to 5001; repeat step 3.
  5. go to http://127.0.0.1:5000 OR http://127.0.0.1:5001.
  6. see instructions above

Docker or the already deployed version are recommended.