Cannot link with Philips Hue: "The requested permission could not be verified."

Hey there! Just started using n8n (desktop version for now). I’ve set up a dev account at philips hue and created an app with the correct callback url. Copy/pasted the client id and secret. I click “Connect my account” in n8n, which opens a philips hue page in Chrome, only to be met with this:

I’ve got no clue to what’s wrong. Any ideas?

Hi @nicwillu, I’m sorry you’re running into this behaviour. I’ve tried to reproduce and debug the problem, but don’t have any Hue hardware, so would run into this error:

image

From taking a look at their documentation a real bridge appears to be required for development and testing, so I won’t be able to help with this first hand for now.

It does however seem the OAuth endpoints laid out here differ slightly from the ones used by n8n and I wonder if this might be the problem.

I’ll check internally if we have a Hue bridge at n8n which I can use for further testing :slight_smile:

Thanks for the reply! I guess I could manually connect with the endpoints, but you would assume the integrated oauth identification in n8n would work. The client id and client secret are the only two things I am supposed to enter in before I click “Connect my account”, and it does not work sadly.

Update: So I followed their documentation and there seems to be different from what n8n tries to use.

So instead of
https://account.meethue.com/get-token/?client_id=
it should be
https://api.meethue.com/v2/oauth2/authorize?client_id=

or am I wrong?

and then I got this

but upon clicking Yes, it just keeps loading and eventually responds with a bad gateway. Perhaps it has to originate from the n8n app?

Yes, that’s what I meant earlier. The URLs appear to have changed since the Hue node and its credentials were created.

You could always try using the HTTP Request node as it lets you pick OAuth2 credentials (for which you can manually configure all settings), but would be slightly more cumbersome to configure.

Sadly, this would still not help seeing Hue doesn’t let me authenticate at all without the respective hardware.

The bad gateway error might suggest you are using a non-functional redirect URL.

Hmm so I guess I am getting somewhere. The appid is an optional field but I filled it in. I don’t get the permission error again. However when I press “yes” I just get a 404 with the redirect looking like this:

https://rude-newt-6.hooks.n8n.cloud/rest/oauth2-credential/callback?code=(removed)&state=eyJ0b2tlbiI6IjBhS1hHZ1VXLUUzMzh1NS1PX3d1ODM2cWxvTFRLSFEtTGVITSIsImNpZCI6IjQifQ%3D%3D

This URL suggests your tunnel might be broken as described here:

That’s unfortunately a problem with the tunnel service in use and the suggested workaround would be to trigger the creation of a new tunnel by editing the config file in which the tunnel identifier is stored.

In case Hue supports localhost redirects, you could also try using http://localhost:5679/rest/... as the redirect URL instead of the tunnel URL.

Just a quick update on this: We’re getting there! I got my hands on a Hue Bridge and raised a PR fixing the connection problems:

Will let you know once this has been released.

Fix got released with [email protected].

1 Like

Hello…My bridge is not working suddenly…the third last light(the little world) it stays off…I resetted…cancelled redone app andbridge but nothing…can somebody translate in plain English how to fix this,please?
Thank you for your patience