> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.onesignal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon API key generation

> Step-by-step guide

Amazon Device Messaging (ADM) requires two sets of credentials to send push notifications to **Amazon** (Fire OS) apps:

* **OAuth credentials** — a **Client ID** and **Client Secret**, which OneSignal uses to authenticate with the ADM servers.
* **An API key** — which ADM uses to verify your app's identity on-device. This key is stored inside your app's project.

Both come from a **Security Profile** in the Amazon Developer Console.

## Requirements:

* An app already added to the [Amazon Developer Console](https://developer.amazon.com/dashboard).
* An [Amazon Developer account](https://developer.amazon.com/dashboard).
* A [OneSignal Account](https://onesignal.com/), if you do not already have one.

<Steps titleSize="h2">
  <Step title="Create or assign a security profile">
    Log in to the [Amazon Developer Console](https://developer.amazon.com/dashboard).

    From the top navigation bar, choose **My Apps**. Find your app, expand the row, and select **View** to open the app listing.

    In the sidebar, click **App Services**.

    In the **Device Messaging** section, click **Select existing security profile or create new**.

    <Note>
      If you have already assigned a security profile to your app, expand the **Attached security profile and related details** section and skip ahead to the next step.
    </Note>

    Choose an existing profile from the **Security Profile** drop-down menu, or click **Create Security Profile** to create a new one. A security profile provides the OAuth credentials you'll use to send messages with ADM.

    Click **Enable Security Profile** to save. You should see a success message confirming device messaging was enabled on your app.
  </Step>

  <Step title="Generate an API key">
    The following steps let you test push notifications before publishing your app to the Amazon Appstore.

    Click the **View Security Profile** link. Under **Security Profile Management**, click the **Android/Kindle Settings** tab.

    Click **Add an API Key**. To create the key, provide:

    * **API Key Name** — any name you like.
    * **Package name** — your Android package name (for example, `com.mycompany.bestapplication`). This value is case sensitive.
    * **MD5 and SHA-256 signatures** of the keystore used to sign your app.

    <Note>
      Amazon now requires **both** the MD5 **and** SHA-256 values of your signing certificate.
    </Note>

    To obtain your signature values, use any of the following:

    * **From your keystore** (replace the alias and keystore name with your own):

      ```bash theme={null}
      {JAVA_HOME}/bin/keytool -list -v -alias my_certificate_alias -keystore my_keystore_file
      ```

    * **From a signed APK** (on a Unix-like system):

      ```bash theme={null}
      unzip -p your-app.apk META-INF/CERT.RSA | keytool -printcert | grep MD5
      unzip -p your-app.apk META-INF/CERT.RSA | keytool -printcert | grep SHA-256
      ```

    * **From Android Studio** — open the **Gradle** side pane, expand **app > Tasks > android**, and double-click **signingReport**.

    <Warning>
      We recommend not using the default debug keystore for production. If you do use it for testing, redo this step with your **production** keystore before release, or let Amazon sign your app for you.
    </Warning>

    When you're done, click **Add**.

    Copy the generated **API key** — you'll store it in your app's project (see the final step).
  </Step>

  <Step title="Get your OAuth credentials (Client ID and Client Secret)">
    Still under **Security Profile Management**, click the **Web Settings** tab.

    Copy the **Client ID** and **Client Secret** shown on this page. You'll paste these into OneSignal in the next step.
  </Step>

  <Step title="Configure your OneSignal app's Amazon platform settings">
    In the OneSignal dashboard, select your app from the **All Apps** page, then go to **Settings**. Under **Native App Platforms**, click **Amazon Fire**.

    Paste your **Client ID** and **Client Secret** into the fields and click **Save**.
  </Step>

  <Step title="Store the API key in your app">
    Save the **API key** you copied earlier into a new file named `api_key.txt`.

    Place this file inside your project's **`assets`** folder. This location is required for ADM to find the key.

    <Warning>
      Insert the API key as the **only** data in the file. ADM cannot recognize the key if it contains any spaces or line breaks.
    </Warning>

    For a release (production) build, you may need to generate an additional API key depending on how your app is signed. If your app uses the Appstore SDK, or you sign the release build with your own certificate, create a separate API key for the release signature. If you use IAP SDK v2.0 (or no in-app purchasing SDK) and let Amazon sign your app, no additional release key is needed.

    More details on the placement of this file can be found in our [Amazon SDK Setup](./amazon-sdk-setup) documentation.
  </Step>
</Steps>

***

<Check>
  **Done!** You now have the OAuth credentials and API key needed to send push notifications to your Amazon app. 🥳

  Return to the [Amazon SDK Setup](./amazon-sdk-setup) guide to install the OneSignal SDK in your app.
</Check>

***
