How to use dynamics params in custom_params of grant auth package?

14 views Asked by At

I want to use dynamic values in custom_params option of grant config in Hapi js, can anyone help me how to achieve it? example:-

config.json

{
  "defaults": {
    "origin": "http://localhost:3000",
    "transport": "session"
  },
  "google": {
    "key": "APP_ID",
    "secret": "APP_SECRET",
    "dynamic": ["domain"],
    "custom_paras": {
        "resource": `https://${domain}`
    },
    "response": ["tokens", "raw", "jwt"],
    "callback": "/hello"
  }
}

I have tried using a function to populate dynamic query params before plugin in being registered in server, but its not working

config.google.custom_params = (request) => {
  const domain = request.query.domain;
  return {
    resource: `https://${domain}`,
    response_mode: 'query',
  };
};
0

There are 0 answers