Create account path after omniauth incorrect
I'm getting an odd sign up flow whereby after connecting with Facebook, the "sign up" path at the Create Account page redirects to the hostname rather than the app. Here's how it flows, currently:
Click the sign up with Facebook button
Authorise on Facebook.com successfully
Redirected back to Loomio to Create Account page (/users/sign_up)
Click "Create Account"
Incorrectly redirected to "youthdeclaration.unyouth.org.nz" (the hostname) instead of "go.youthdeclaration.unyouth.org.nz" (actual Loomio app)
Navigating back to Loomio works fine and shows the "Welcome, you've signed up successfully" message, but it's a little clunky being redirected back to home page rather than Loomio.
This doesn't happen when logging in with Facebook as usual (i.e. already have an account with Facebook)
I've probably messed up something, somewhere in my weird hack job of an installation – any ideas would be appreciated! :)
I think it's defined by Facebook ... all the app domains and the OAuth redirect URI are set to "go.youthdeclaration.unyouth.org.nz" in the Facebook app settings
What is your CANONICAL_HOST, DEFAULT_SUBDOMAIN and TLD_LENGTH?
You should be able to see a callback url being sent to facebook at the start of the process. Using a fresh private browser, after you click "Facebook" from the loomio login screen, the facebook sign in page will have a long url with the callback url embedded in it. Does the callback url have the right address?
Also, have you got an error logger setup? such as Errbit?
CANONICAL_HOST = go.youthdeclaration.unyouth.org.nz
DEFAULT_SUBDOMAIN = go.youthdeclaration.unyouth.org.nz
TLD_LENGTH = 4
and the callback url embedded is: http://go.youthdeclaration.unyouth.org.nz/users/auth/facebook/callback
I haven't setup an error logger but I might go ahead and setup Airbrake now
Airbrake doesn't report any errors after the redirect
DEFAULT_SUBDOMAIN should just be 'go'.
CANONICAL_HOST and TLD_LENGTH are correct
The benefit if airbrake is that in production it let's you do some basic debugging to see what's going on, but it might not be helpful in this case.
From your browser you hopefully can see if facebook is redirecting you to go.youthdeclaration.unyouth.org.nz or just youthdeclaration.unyouth.org.nz.
If facebook is sending you 'go' but loomio is redirecting you to 'without go' then its probably a bug that needs fixing. I'm happy to help try to solve it.
Hmm, just to throw another spanner in the works –navigating to "go.youthdeclaration.unyouth" from "youthdeclaration.unyouth" and logging into a non-Facebook linked account at users/sign_in redirects to "youthdeclaration.unyouth" also.
This isn't a hugely important or time-critical issue so I don't mean for you (or anyone else) to spend time better utilised on actual development, but I do appreciate the help. I've probably messed up something, somewhere.
Where is the callback url defined for facebook logins? Is it in the facebook app or does loomio send it along?