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

UID returns client access_token instead of user id? #4

Open
ryenski opened this issue Mar 29, 2017 · 3 comments
Open

UID returns client access_token instead of user id? #4

ryenski opened this issue Mar 29, 2017 · 3 comments

Comments

@ryenski
Copy link
Contributor

ryenski commented Mar 29, 2017

Currently the uid attribute returns the access_token for the client request:

uid { access_token.client.id }

It seems like the uid attribute should return the Drip user's ID instead:

uid { raw_info["accounts"][0]['id'] }
@ryenski
Copy link
Contributor Author

ryenski commented Mar 29, 2017

This was causing a problem in my app because the client.id corresponds to the authorized application, not the user who is authorizing. My understanding of the OmniAuth hash schema is that the uid should be the user's unique ID in the authorizing application (e.g. Drip's user id). Is this also your understanding?

I made this change in my local gem, and it works as expected. I'd like to submit a PR, however I'm not sure how to write a test for this. Do you have any thoughts on that?

@derrickreimer
Copy link
Contributor

derrickreimer commented Mar 29, 2017

A PR would be welcome! This gem was originally authored by an external party, which is probably how this slipped through. You could look to the way the GitHub omniauth gem stubs out raw_info for guidance on how to test this: https://github.com/intridea/omniauth-github/blob/master/spec/omniauth/strategies/github_spec.rb. (Admittedly, test coverage as it stands right now is very limited).

@ryenski
Copy link
Contributor Author

ryenski commented Mar 29, 2017

Good deal... I've got that PR ready for you

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