Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirection trouble with raspberry pi #118

Open
fabien14840 opened this issue Mar 31, 2015 · 14 comments
Open

Redirection trouble with raspberry pi #118

fabien14840 opened this issue Mar 31, 2015 · 14 comments

Comments

@fabien14840
Copy link

HI all,

Here's my trouble,

I'm using the google calendar node on a raspberry pi (I access it via a computer). I wrote an entry in hosts, created an app with the right redirect URI ("node-red-example.com").

But when I try to authenticate with google, after having accepted the permissions, the redirection to the page "Authorised - you can close this window and return to Node-RED" fails (web browser returns a 105 error code), I think it is because the DNS does not know the "node-red-example.com" domain...

It only works if i replace manually the "node-red-example.com" with my raspberry IP in the failing URL, do you have any solution to provide having to do it by myself each time ?

@knolleary
Copy link
Member

Having you followed the second part of the instructions:

Please configure the authorized Redirect URIs of your app to include the following url:
http://node-red-example.com/google-credentials/auth/callback
You will need to edit your hosts file and add an entry for node-red-example.com that points to the actual IP address of your Raspberry Pi.

@fabien14840
Copy link
Author

Yes i did, because without that, google says that the redirect URI does not match any registered redirect URI

@knolleary
Copy link
Member

As well as the bit about editing your hosts file?

@fabien14840
Copy link
Author

Yes, I created an entry in /etc/hosts first, that associates the name "node-red.example.com" to my Raspberry IP

@knolleary
Copy link
Member

So if you made that entry, can you browse to http://node-red.example.com:1880 to see the node-red UI?

@fabien14840
Copy link
Author

No, i cannot (browser error code : 105), because i access to node-RED on my raspberry by the use of a computer, and the computer only get access to node RED ui with raspberry_IP:1880 or Raspberry_hostname:1880, but only the Raspberry knows what node-red.example.com means, I think that is the reason of the issue

@knolleary
Copy link
Member

Yes. You need to edit the hosts file of the computer you are accessing node-red from - as that is the computer that needs to be able to resolve the address.

@fabien14840
Copy link
Author

Thanks but this solution does not please me that much, because I will need to repeat this step each time I access it from a new computer, and it isn't viable for what I wanna do...

I found an alternative, i am currently trying to authenticate this way :

https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi

@knolleary
Copy link
Member

You only need to do this once to complete the authentication process.

@hindessm any comments?

@fabien14840
Copy link
Author

Once for each computer that provide my Node-RED access, am I wrong ?

@knolleary
Copy link
Member

It depends what exactly you are trying to do.

The authentication flow is needed to give Node-RED the necessary access tokens to talk to the google api. You need to set that up once for your flow. So you only need to the host setup on the computer from which you access Node-RED when you are setting up the google node.

@fabien14840
Copy link
Author

In fact, I try to change this node configuration, my goal is to make the oauth as simple as in the node RED core Twitter Node.

As I imagine this, i get the node, i open config and I click on a authenticate with google button (with google client secret and id already registered in the code) , and it works. But I don't think something as simple is possible if the only solution we have is to configure the computer host in order to make it work...

@knolleary
Copy link
Member

The twitter api does not restrict the url you redirect the browser to after authentication; you can specify it as part of the auth flow. This allows us to set a redirect_url dynamically that will work regardless of where node-red is installed and how you are accessing it.

With the google api (as well as foursquare/swarm and a number of others), you have to provide the redirect_url as part of the app configuration andyou must use that redirect_url as part of the flow.
We cannot pre-register an app with these apis with a redirect_uri that will Just Work for everyone.

Some of these APIs also explicitly forbid us from registering an app that everyone then uses - they require each user to register their own app.

@fabien14840
Copy link
Author

But the issue remains, even with your version of the node, so do you think my redirection trouble's unique solution is to configure the computer hosts ? I'll keep searching about the link I mentioned earlier, to see if it solves it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants