thoughtbot / carnival

An unobtrusive, developer-friendly way to add comments
MIT License
499 stars 30 forks source link

'Authentication Error' with github sign-in #282

Closed boxofrox closed 8 years ago

boxofrox commented 8 years ago

Steps to reproduce:

  1. Use a github account that hasn't authorized Carnival, or revoke the Carnival access token in Github > Settings > Applications.
  2. Visit https://carnivalapp.io/auth/login?dest=https://carnivalapp.io/
  3. Select 'Sign in with Github'
  4. Select 'Authorize Application'
  5. Observe redirect to https://carnivalapp.io/auth/login with message "Authorization Error".

Expected behavior: Some form of logging into Carnival where I could leave comments on Carnival enabled blogs.

jferris commented 8 years ago

@boxofrox sorry that you're running into errors. I just tried it with my account using your steps, and I end up logged in.

Could this have been an intermittent issue with the GitHub API? Can you try again now?

boxofrox commented 8 years ago

I tried signing in again twice with github, but I still get the "Authorization Error". First tried with existing token I created for Carnival from earlier, then revoked that, and created a new token.

I checked the console log in case a more specific description of the problem was dumped there, but it's blank.

Not sure what else I can provide that would assist in reproducing this. If you need my public IP address to cross reference log files, I'm willing to provide it.

jferris commented 8 years ago

Searching for "auth" in today's logs, I found this entry:

10/Nov/2015:17:38:22 +0000 [Error] github: missing key name @(yesod-auth-1.4.4:Yesod.Auth ./Yesod/Auth.hs:314:15)

Maybe our GitHub sign in only works for users who have a name set on their GitHub profile? Can you try setting your name and logging in? If that's the issue, I think it's a bug on our end.

jferris commented 8 years ago

Looks like we do return an error for profiles without a name: https://github.com/thoughtbot/carnival/blob/master/Model/User.hs#L89

The GitHub OAuth2 Yesod adapter returns both name (Maybe Text) and login (Text) keys, so we could look for name and fall back to login

boxofrox commented 8 years ago

Setting the name in my profile worked. Nice find.

jferris commented 8 years ago

Cool. Thanks for working through that with me. I'll try to get the login fallback in on Friday.

boxofrox commented 8 years ago

My pleasure. I'll let you close the issue at your convenience.