My current setup is like this. I have multiple actions project on Google Actions. They are all using the Actions SDK and using the same fulfillment webhook.
I am using account linking (with Google Sign In) on the actions projects. The guideline here initializes the actionssdk with a static clientId like this:
const app = actionssdk({
// REPLACE THE PLACEHOLDER WITH THE CLIENT_ID OF YOUR ACTIONS PROJECT
clientId: CLIENT_ID,
});
But for my use case, I have to dynamically set the clientId based the the projectId of the actions project. I can extract the projectId inside the actions.intent.MAIN intent and retrieve the stored clientId from DB there.
What is the best way to achieve this?
What I have tried additionally:
I initialized the actionssdk with a dummy clientId like this:
This approach works initially for a single project. But is fails with Error: Wrong recipient, payload audience != requiredAudience as soon as nodemon reloads the express app.
My current setup is like this. I have multiple actions project on Google Actions. They are all using the Actions SDK and using the same fulfillment webhook.
I am using account linking (with Google Sign In) on the actions projects. The guideline here initializes the
actionssdk
with a staticclientId
like this:But for my use case, I have to dynamically set the
clientId
based the theprojectId
of the actions project. I can extract theprojectId
inside theactions.intent.MAIN
intent and retrieve the storedclientId
from DB there.What is the best way to achieve this?
What I have tried additionally:
I initialized the
actionssdk
with a dummyclientId
like this:After that, inside
actions.intent.MAIN
intent, I've replaced it with an actualclientId
This approach works initially for a single project. But is fails with
Error: Wrong recipient, payload audience != requiredAudience
as soon asnodemon
reloads the express app.Some information regarding my setup: