Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Steps to Set Up Basic Authentication:

  1. Create an "API “API dRofus user":

    • Do not use your personal account for this.

    • Ensure the API user's email is not set to your own.

    • Generate a strong password for this user.

      image-20241015-121802.pngImage Added
  2. Add the user to the project:

    • Ensure that this user has sufficient access to perform the required API operations.

  3. Set up authentication:

    • In Postman, select Basic Auth as the authentication type.

    • For scripts, you need to encode the username and password into base64. Here's an example of how to do this in Python:

    Code Block
    languagepy
    import base64
    import os
    from dotenv import load_dotenv
    
    credentials = f"{os.getenv("DR_USERNAME")}:{os.getenv("DR_PASSWORD")}"
    encoded_credentials = base64.b64encode(credentials.encode()).decode()
    
    # Encoded string can then be used for Basic Authentication in your API requests:
    headers = {"Authorization": encoded_credentials}

...