Enrich profile with tower data - is example code missing something?

Hi,

is the example code provided for enriching profile with tower data missing something ? This is what I get from Auth0 as suggested code and it seems to maybe be missing the actual adding data to the profile part ?:

function getTowerdataProfile(user, context, callback) {
const request = require(‘request’);

//Filter by app
//if(context.clientName !== ‘AN APP’) return callback(null, user, context);

if (!user.email || !user.email_verified) {
return callback(null, user, context);
}

request.get(
https://api.towerdata.com/v5/td’,
{
qs: {
email: user.email,
api_key: configuration.TOWERDATA_API_KEY
},
json: true
},
(err, response, body) => {
if (err) return callback(err);

  if (response.statusCode === 200) {
    context.idToken['https://example.com/towerdata'] = body;
  }

  return callback(null, user, context);
}

);
}

It is actually adding a claim in the id token here

context.idToken[‘https://example.com/towerdata’] = body;
}

That’s right after the api returns a response with status code 200 or OK

But just adding a claim to an idToken once doesn’t add any data to the profile ? Looking at the similar boiler plate code for doing something similar with the “FullContact” service it has more code that actually updates the user profile so this looks like a mistake to me ?

No, it will not update your profile. The data will be injected on the fly on the issued ID token before it is returned to the client application, but no persistent change will be made on the profile.

1 Like