Using pre registration Hooks to prevent duplicate account creation

In principle yes.

In the end as there is no management api token in Hooks as there is in Rules i’ve had to get the token directly.

eg:

var options = {
method: ‘POST’,
url: ‘https://’ + domain + ‘/oauth/token’,
headers: {‘content-type’: ‘application/x-www-form-urlencoded’},
form: {
grant_type: ‘client_credentials’,
client_id: client_id,
client_secret: client_secret,
audience: ‘https://’ + domain + ‘/api/v2/’
}
};

tokenRequest(options, function (error, tokenResponse, body) {
if (error) throw new Error(error);