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

How to debug? #49

Closed
talkingtab opened this issue Mar 23, 2016 · 4 comments
Closed

How to debug? #49

talkingtab opened this issue Mar 23, 2016 · 4 comments

Comments

@talkingtab
Copy link

I am trying to get the amazon provider to work, I'm having problems but I have no idea what the problem is. I have Facebook working. How does one debug this? I'm thinking of writing a simple server using just the node https server (since it seems like Amazon only works with https, not http). Any help, ideas, suggestions? Thanks

@simov
Copy link
Owner

simov commented Mar 23, 2016

Yep amazon accepts only https protocol as redirect URL. That's the first result from Google when you search for expressjs https.

I personally use NginX on my workstation as a proxy server on top of my node web server processes.

Here is the NginX vhost configuration for the example app:

server {
  listen 80;
  listen 443;

  server_name grant-oauth.herokuapp.com;

  ssl on;
  ssl_certificate     /home/path/grant-oauth/config/public.pem;
  ssl_certificate_key /home/path/grant-oauth/config/private.pem;

  allow 127.0.0.1;

  access_log /var/log/nginx/grant-oauth-access.log;
  error_log /var/log/nginx/grant-oauth-error.log debug;

  # node
  location / {
    proxy_pass http://127.0.0.1:3000/;
    proxy_set_header Host $http_host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  }
}

@talkingtab
Copy link
Author

Thanks very much for the help. I wasn't clear, I guess. I have https working with letsencrypt providing the certificate. And only https is running.Facebook works just fine over https, I just can't get Amazon to work and I am trying to come up with a way to find out what is wrong. I was hoping there was some debugging facility or way to get a clue.

@simov
Copy link
Owner

simov commented Mar 24, 2016

You can always add a breakpoint inside your dependency code and expect what's going on.

Authenticating with Amazon is working here: https://grant-oauth.herokuapp.com/#/amazon

You just have to set your redirect URL to use https:

https://[domain]/connect/amazon/callback

And set at least one scope, because having at least one scope set for Amazon is required:

scope: ['profile']

@talkingtab
Copy link
Author

My mistake was that I create a grant object programmatically and I didn't set an Amazon provider. I found my problem by comparing url's for Facebook that was working, and for Amazon. Amazon did not have a client key set, nor a scope, etc because I had not appended the provider. It would be a nice feature to have some error reported when calling http://domain/connect/provider when there is no matching provider in the grant.

Thank you for the help!

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