Skip to content

Integrating HID with Auth0

Guillaume Viguier-Just edited this page Oct 14, 2019 · 8 revisions

Integrating HID with Auth0 is relatively straightforward. Here is what you will need to do:

  1. Follow the Auth0 documentation to add a new custom social connection: https://auth0.com/docs/connections/social/oauth2
  2. Create a new custom social connection with the following parameters:
      function(access_token, ctx, callback) {
        request.get('https://auth.humanitarian.id/account.json', {
          'headers': {
            'Authorization': 'Bearer ' + access_token,
            'User-Agent': 'Auth0'
          }
        }, function(e, r, b) {
          if (e) return callback(e);
          if (r.statusCode !== 200) return callback(new Error('StatusCode:' + r.statusCode));
          var profile = JSON.parse(b);
          delete profile._id;
          callback(null, profile);
        });
      }
  1. Save and try the new connection