How can I associate an Alexa skill with a catalog?

85 views Asked by At

I am trying to associate my Alexa skill with a catalog that I created by hitting the https://api.amazon.com/v0/catalogs endpoint with an Auth token that I had generated through a LWA profile.

This worked, and I created a catalog like so:

{
  associatedSkillIds: [],
  createdDate: '2022-01-22T20:50:37.318Z',
  id: 'amzn1.ask-catalog.cat.[REDACTED]',
  lastUpdatedDate: '2022-01-22T20:50:37.318Z',
  title: 'TestCatalog',
  type: 'AMAZON.AudioRecording',
  usage: 'AlexaTest.Catalog.AudioRecording'
}

However, the next step, associating my Alexa skill with the Catalog is always returning 401 https://developer.amazon.com/en-US/docs/alexa/smapi/catalog-content-upload.html#associate-catalog-with-skill

This is my function to attempt to associate the skill with the catalog:

async associateSkillWithCatalog() {
console.log(`Associating skill...`);
const accessToken = await this.getRefreshToken(); // makes post to https://api.amazon.com/auth/o2/token

console.log(this.alexaEndpoint + this.skillAssoc(cat.id, skillId));

const response = await axios.put(
   "https://api.amazonalexa.com/v0/skills/amzn1.ask.skill.[REDACTED]/catalogs/amzn1.ask-catalog.cat.[REDACTED]",
    {
        headers: {
            'Content-type': 'application/json',
            'Authorization': `Bearer ${accessToken}`
        }
    }
);

return response.data;

}

Always receiving back this Error: Request failed with status code 401\n at createError.

Why would I be receiving 401 Error here, despite other requests against this API not failing?

Thanks!

0

There are 0 answers