coder13 / fantasy-cubing-2017

Each week, pick a team of top cubers to accumulate points!
http://fantasy.cubing.net
3 stars 0 forks source link

OAuth flow is going through HTTP along the way #8

Open jfly opened 7 years ago

jfly commented 7 years ago

From Chrome dev tools when logging in:

image

  1. The /authorize is the OAuth route on the WCA website. The redirect_uri parameter looks like this: redirect_uri=http%3A%2F%2Ffantasy.cubing.net%2Flogin. Note the http, not https.
  2. The first /login? is a HTTP url on fantasy.cubing.net.
  3. The second /login? is a HTTPS url on fantasy.cubing.net.

Fixing 1) should be some reconfiguration of HAPI's auth flow: https://github.com/coder13/fantasycubing/blob/a949667a6413d995eacf5c0fe6c2a611887197aa/server/auth/index.js#L12-L32. I don't know where the redirect uri is configured. However, fixing that won't be enough, you'll also need to configure the WCA website to allow redirects to the HTTPS url, right now I see over on https://www.worldcubeassociation.org/oauth/applications/13/edit that only http://fantasy.cubing.net/login is listed as a redirect uri, not https://fantasy.cubing.net/login.

jfly commented 7 years ago

I don't know where the redirect uri is configured.

Ok, after digging into HAPI internals, here's what I've found:

Another solution might be to set settings.location to something, which would short-circuit the internals.location method here (called from here).

jfly commented 7 years ago

Bump! Was just looking at all the WCA OAuth applications and was reminded of this.