-
Notifications
You must be signed in to change notification settings - Fork 9
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
Why OAuth 2.0 protocol requires a session support? #23
Comments
Hi Lazis, Here is great article about it written by Jared Hanson. Jan |
Note that the error is thrown by the underlying OAuth2 strategy, we just rely on its PKCE implementation which requires session. I think one of our users managed to bypass this requirement by injecting a custom PKCE resolver which just passed a static challenge key. I will try to dig it up. |
@jnv, thanks a lot! |
Passing static challenge key is not security issue when using PKCE with Twitter should support server side authentication by not forcing the PKCE flow, but here we are looking for workaround. |
When I provide an
{session: false}
option to passport.authenticate() method, it gives the error below:Error: OAuth 2.0 authentication requires session support when using state. Did you forget to use express-session middleware?
As I know Twitter started to fully support OAuth 2.0 protocol relatively recently, so now we are able to use this auth protocol on scheme like application-user authentication (OAuth 2.0 Authorization Code Flow with PKCE), and not only for application-only authentication (App only). Thus, this new feature enables the use case where we can handle an auth flow on our own, e.g. using it without session at all. That's why,
passport
provides{session: false}
option to disable keeping tokens in a session when needed to query the API on behalf of users without using libraries likeexpress-session
, andpassport
already supports this working style for Google, Facebook and etc.To better understand the issue, you can refer (at that time Twitter didn't support OAUTH 2.0 with PKCE, but anyway the discussion makes sense so far):
https://stackoverflow.com/questions/44071555/why-passport-twitter-requires-session-support
Could you please enable the option {session: false} passed into passport.authenticate()? And, if this library already supports this behavior, could you please give me a hint to fix this issue? Thanks.
The text was updated successfully, but these errors were encountered: