-
Notifications
You must be signed in to change notification settings - Fork 24
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
Continual prompting of permission to allow #11
Comments
Well, looks like reddit doesn't care if user have allowed you access in the past. In all honesty, I'm not sure I disagree with that decision. Now, let me explain why I don't disagree with them. OAuth2 is first and foremost an authorisation protocol. Ability to authenticate your users is an inevitable side-effect, nothing more, nothing less. User authorises you to represent them in certain scopes of activity: read their data, post on their behalf etc. Granting such permissions just because you've been granted them in the past is insecure without control over your app's secret. It's not an insecurity that's easy to exploit, but it's insecurity nonetheless. Anyways, duration parameter represents only one thing - duration of validity of the tokens that reddit returns you:
When you request permanent duration, you get refresh token in addition to access token. How you persist this data, how you recognize the returning user, how you manage authentication in case of returning visitor is all up to you. I'm not sure how other OAuth2 providers handle this scenario (github is more lenient as far as I remember, but don't take my word for it), but reddit complies to RFC with the way they do it:
You have three options:
Unfortunately there's not much I can do for you through passport-reddit, except ensuring that duration parameter get's to destination. Sorry. |
That's a bit frustrating. I'm new to Passport, but I was expecting that each module would magically take care of the minor details of the authentication - however I do understand that it couldn't be that simple with every oauth endpoint. From reading the Reddit spec on
Would it not be best to manage the refreshing, in permanent mode, through the I agree that using this for user registration on a site would still be completely suitable, but this issue does somewhat ruin the experience when using it as login mechanism (such as I am). |
Short answer, it's not that simple. Long answer, there exists a library for that, but do read a short answer and oauth2-refresh's issue #1. Even then there is no fault proof universal refresh strategy available. Any attempt to introduce a solution into this library will inevitably and justifiably upset someone. Thus I'm keeping it simple.
This is separate to refresh flow and has little in common with it. I can do nothing to make Reddit not ask your user to authorize your app over and over. It's about your user logging out or clearing cookies, destroying all means for you or my library to identify them. You still possess tokens that let you act on behalf of user in some other system, but you have no data that would allow you to match your visitors to particular sets of tokens you received earlier. End of story. You can initiate another authorization session in hope that a) remote system will handle repeated authorization in a transparent manner b) send you their internal id, that c) is immutable across requests. Alternatively you can use initial authorization to populate your registration data and ask your new user to choose password or some other means of authorization. Thus removing three ifs from your workflow. If you've selected "Web app" as your app type during app creation and reddit still requires explicit authorization every time, then I can do nothing short of creating a pull request to reddit/reddit, that is going to be rejected. |
Ok, thanks for the in-depth replies, I appreciate it. I will be in contact with Reddit in some manner regarding this, but in the mean time I probably won't be using Reddit as an authentication mechanism for precisely the point you stated - transparency. That being said, if we move to a registration-style auth system, I would definitely use Cheers. |
Each time I log in with Reddit, I am asked to "Allow" my app to permanently login the user:
My config:
My setup:
If I logout and return to the Reddit auth, I'm prompted again - same with restarting the server.
Versions:
The server is node and express (latest) on Ubuntu 14.04.
The text was updated successfully, but these errors were encountered: