Monday, January 31, 2011

Re: Facebook session problems.

Which session are you losing?
The django authenticated session, or the facebook session?

On Jan 29, 10:30 pm, CrabbyPete <pete.do...@gmail.com> wrote:
> I managed to log into facebook using the graph api, I store the FB id
> and tie it to a User, like this
>
> class FacebookUser(models.Model):
>     user            = models.ForeignKey(User)
>     fb_uid          = models.CharField( max_length=100, blank = True,
> unique = True )
>     access_token    = models.CharField( max_length=100, blank = True,
> null   = True )
>
>     def __unicode__(self):
>         if self.user.username == u'':
>             return str(self.pk)
>         return self.user.username
>
> after I get the user I do the following:
> user = auth.authenticate(username=user.username, password=password)
>     if user is not None and user.is_active:
>         auth.login(request, user)
>
> I log in and all is good except I loose the session if I go to another
> web site and come back.
>
> Any help or advice greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment