I've been reading a little bit and seems that I won't be able to override a
private function :-/

On Sun, Nov 13, 2011 at 9:33 PM, Tito Garrido <titogarr...@gmail.com> wrote:

> Hi Michele!
>
> Thanks for your answer! How can I override OAuthAccount subclass putting
> http_host as a fixed?
>
> I'm doing:
> class FaceBookAccount(OAuthAccount):
>     """OAuth impl for FaceBook"""
>     AUTH_URL="https://graph.facebook.com/oauth/authorize";
>     TOKEN_URL="https://graph.facebook.com/oauth/access_token";
>
>     def __init__(self, g):
>         OAuthAccount.__init__(self, g,
>                               YOUR_CLIENT_ID,
>                               YOUR_CLIENT_SECRET,
>                               self.AUTH_URL,
>                               self.TOKEN_URL)
>         self.graph = None
>
>
>     def __redirect_uri(self, next=None):
>         """Build the uri used by the authenticating server to redirect
>         the client back to the page originating the auth request.
>         Appends the _next action to the generated url so the flows
> continues.
>         """
>
>         r = self.request
>         http_host=r.env.http_x_forwarded_for
>         if not http_host: http_host=r.env.http_host
>         http_host='MYAPP.fluxflex.com'
>
>
>         url_scheme = r.env.wsgi_url_scheme
>         if next:
>             path_info = next
>         else:
>             path_info = r.env.path_info
>         uri = '%s://%s%s' %(url_scheme, http_host, path_info)
>         if r.get_vars and not next:
>             uri += '?' + urlencode(r.get_vars)
>         return uri
>
>     # override function that fetches user info
>     def get_user(self):
>         "Returns the user using the Graph API"
>         if not self.accessToken():
>             return None
>         if not self.graph:
>             self.graph = GraphAPI((self.accessToken()))
>         try:
>             user = self.graph.get_object("me")
>             return dict(first_name = user['first_name'],
>                         last_name = user['last_name'],
>                         email = user['email'],
>                         registration_id = user['id'])
>         except GraphAPIError:
>             self.session.token = None
>             self.graph = None
>             return None
>
> What am I doing wrong? Because it's ignoring my override...
>
> Thanks in advance!
>
>
> On Sun, Nov 13, 2011 at 8:06 PM, Michele Comitini <
> michele.comit...@gmail.com> wrote:
>
>> Hi Tito,
>>
>> When you call the server from browser do you put the hostname?
>> I guess there is a problem with wsgi implementation on fluxflex.
>>
>> The oauth20_account.py module contains the following method:
>>
>>    def __redirect_uri(self, next=None):
>>        """Build the uri used by the authenticating server to redirect
>>        the client back to the page originating the auth request.
>>        Appends the _next action to the generated url so the flows
>> continues.
>>        """
>>
>>        r = self.request
>>        http_host=r.env.http_x_forwarded_for
>>        if not http_host: http_host=r.env.http_host
>>
>>        url_scheme = r.env.wsgi_url_scheme
>>        if next:
>>            path_info = next
>>        else:
>>            path_info = r.env.path_info
>>        uri = '%s://%s%s' %(url_scheme, http_host, path_info)
>>        if r.get_vars and not next:
>>            uri += '?' + urlencode(r.get_vars)
>>        return uri
>>
>> Override it in your OAuthAccount subclass putting http_host as a fixed
>> value instead of taking it from request.env
>>
>> HTH
>>
>> mic
>>
>>
>>
>> 2011/11/12 Tito Garrido <titogarr...@gmail.com>:
>> > Hi Folks!
>> >
>> > Are you able to login using Oauth2.0 on fluxflex?
>> >
>> > I'm trying to but seems that OAuthAccount grabs the ip of my instance
>> and
>> > the facebook never recognizes my redirect URL.
>> >
>> > Anybody with this problem?
>> >
>> > Regards,
>> >
>> > Tito
>> >
>> > --
>> >
>> > Linux User #387870
>> > .........____
>> > .... _/_õ|__|
>> > ..º[ .-.___.-._| . . . .
>> > .__( o)__( o).:_______
>> >
>>
>
>
>
> --
>
> Linux User #387870
> .........____
> .... _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:_______
>



-- 

Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______

Reply via email to