Custom Social Connections Extension - Philips Hue OAuth 2

Hi,

I’m experimenting with the Custom Social Connections Extension and I’m desperately trying to get PhilipsHue Authentication to work. The API requires two additional parameters:
PhilipsHue API

I found this piece of documentation, where there is an example on how to “pass static parameters”.
Add a generic OAuth2 Authorization Server to Auth0

Unfortunately I don’t know how to implement this in the SPA provided as an example on Github. Any advice on how to modify the app.js file to get this working?

Thanks in advance!

:wave: @guiseppe I am not familiar with the PhilipsHue API, what parameters do you need to pass? You said they are static so I believe we can use the Management API to send a PATCH to the connection you setup an configure it to always pass the values in the when authorizing a user.

var request = require("request");

var options = { method: 'PATCH',
  url: 'https://<TENANT-NAME>.auth0.com/api/v2/connections/CONNECTION-ID',
  headers: { 'content-type': 'application/json' },
  body: 
   { options: 
      { client_id: '...',
        client_secret: '...',
        authParams: { param1: 'foo', param2: 'bar' },
        authorizationURL: 'https://api.meethue.com/oauth2/auth',
        ...
       },
        ...
  },
json: true };

Let me know if I understood what you are trying to do.

Hi again and thanks for your answer! You were right, I had to do this via the Management API. Although I had some problems understanding what to do after your answer, I managed to get it done after some research in your fancy documentation.
I first used Get all connections to get the Id for my desired connection. Afterwards I used Get a connection to fetch the options which I extended with “upstream_params” and finally I used Update a connection to update it.

Thanks for your help!

1 Like