Hi @rhuan.carvalho,
Thanks for the reply.
I have reviewed the code snippet again and found that the correct method to get an access token is management.getAccessToken()
.
With that, I have shared a working code snippet below on initializing an instance of the Management API.
exports.onExecutePostLogin = async (event, api) => {
const ManagementClient = require('auth0').ManagementClient;
const management = new ManagementClient({
domain: event.secrets.domain,
clientId: event.secrets.client_id,
clientSecret: event.secrets.client_secret,
});
const token = await management.getAccessToken();
}
From here, you can proceed with the rest of the account linking logic.
I also recommend checking out this knowledge solution as a reference.
Thanks,
Rueben