-
Notifications
You must be signed in to change notification settings - Fork 102
clear session before Devise::Oauth2Providable::TokensController#create to work with iPhone #21
base: master
Are you sure you want to change the base?
Conversation
…ensController clear the session, so devise does not use session cookie based auth in any case the iPhone SDK by default has a shared cookie jar for WebViews and NSURL Request's and thus will send a cookie to this method
I'd like to keep the devise_oauth2_providable gem as close to the official oauth2 spec as possible. since the spec does not allow for deletion of access tokens, i'd prefer that this functionality be moved to an unofficial gem extension. |
@@ -1,4 +1,5 @@ | |||
class Devise::Oauth2Providable::TokensController < ApplicationController | |||
before_filter :clear_session | |||
before_filter :authenticate_user! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would using force => true
accomplish the same thing?
before_filter :authenticate_user!, :force => true
can you add a unit test to verify that either of these solutions work as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will take a look at when i hvae time => wednesday ,
i dont think that
before_filter :authenticate_user!, :force => true
will work,
as I understand devise it will at first look for a session cookie and the
try strategies to authenticate the user, if the session is there devise will re-authenticate the user by the session cookie
or in depending of the ordering of the strategies
regards Luzifer
On Nov 28, 2011, at 6:39 PM, Ryan Sonnek wrote:
@@ -1,4 +1,5 @@
class Devise::Oauth2Providable::TokensController < ApplicationController
- before_filter :clear_session
before_filter :authenticate_user!would using
force => true
accomplish the same thing?before_filter :authenticate_user!, :force => truecan you add a unit test to verify that either of these solutions work as expected?
Reply to this email directly or view it on GitHub:
https://github.com/socialcast/devise_oauth2_providable/pull/21/files#r254799
Hello there, In order to avoid this problem, I've found another workaround. I'm flushing my iOS cookies with the following snippet:
Hope it'll help. |
Also |
I think that the If I instantiate a OAuth2::Client and attempt to get the token with the same auth code, it raises: http://pastie.org/private/nz3cas3aamm0vgcqizwpw This is just a quick, unfinished test to evaluate devise_oauth2_providable vs doorkeeper. With the session.clear workaround I'm able to properly receive the error invalid_grant, otherwise 500. Using Capybara's reset! won't do anything. |
Hello, I'm writing a chrome extension that will use OAuth2 as authorization layer.
In this case with Am I missing something? Thanks in advance |
👍 needs fixed :) I'm using this workaround for iOS AFNetworking library: //
// AFNetworking subclasses ---------------------------------------------------------------------------------------------
//
@interface CTHTTPClient : AFHTTPClient
@end
@implementation CTHTTPClient
- (NSMutableURLRequest *)requestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters
{
NSMutableURLRequest *req = [super requestWithMethod:method path:path parameters:parameters];
[req setHTTPShouldHandleCookies:NO];
return req;
}
@end
@interface CTOAuth2Client : AFOAuth2Client
@end
@implementation CTOAuth2Client
- (NSMutableURLRequest *)requestWithMethod:(NSString *)method path:(NSString *)path parameters:(NSDictionary *)parameters
{
NSMutableURLRequest *req = [super requestWithMethod:method path:path parameters:parameters];
[req setHTTPShouldHandleCookies:NO];
return req;
}
@end |
Here's how I worked around this issue using Rack middleware, which felt cleaner than hacking session.clear into lib/cookie_filter.rb
Then I added this to config/application.rb:
|
+1 |
see:
atomgas@2bbf960