Authentication between android and django

987 views
Skip to first unread message

Esteban Quintero

unread,
Nov 13, 2012, 1:46:23 PM11/13/12
to django-so...@googlegroups.com
Hello, I need to authenticate a user with facebook from android, but I have a website, I need to authenticate remote.

this is possible?

regards

Matías Aguirre

unread,
Nov 13, 2012, 2:05:22 PM11/13/12
to django-social-auth
Hi Esteban,

Check this thread, this might be what you are looking for:

https://groups.google.com/forum/?fromgroups=#!topic/django-social-auth/zxOVzuQdlDQ

Matías

Excerpts from Esteban Quintero's message of 2012-11-13 16:46:23 -0200:
--
Matías Aguirre (matias...@gmail.com)

Esteban Quintero

unread,
Nov 13, 2012, 2:08:53 PM11/13/12
to django-so...@googlegroups.com
ok thank you very much, I have used this view and it worked perfectly with existing users.

@dsa_view()
def register_by_access_token(request, backend, *args, **kwargs):
    access_token = request.GET['access_token']
    user = backend.do_auth(access_token)
    if user and user.is_active:
        login(request, user)
    return redirect('/')

But how could I do to create a new user with remote facebook?.

Matías Aguirre

unread,
Nov 13, 2012, 2:20:52 PM11/13/12
to django-social-auth
That depends a lot on your project, if the app is native (or installed in the
mobile), then I guess you should check some libraries that do client-side
authentication for Facebook.

If your app runs in a browser, you can redirect the client to /login/facebook/
without troubles.

Makes sense?
Matías

Excerpts from Esteban Quintero's message of 2012-11-13 17:08:53 -0200:
--
Matías Aguirre (matias...@gmail.com)

Esteban Quintero

unread,
Nov 13, 2012, 2:26:02 PM11/13/12
to django-so...@googlegroups.com

Ok 

My app is native, I have everything running on the client side, I have access to acces_token, id of facebook, but do not know how to send the data in a view to create a new user.

This is possible? Create a facebook users remotely?

Matías Aguirre

unread,
Nov 13, 2012, 4:17:33 PM11/13/12
to django-social-auth
Excerpts from Esteban Quintero's message of 2012-11-13 17:26:02 -0200:
Yeah, the solution is on the thread I've mentioned, basically set the view (or
a similar one) in the snipped in that thread under a URL that you will call
from your client (never did native stuff on android, but I guess you will be
able to call an URL). Just pass the access_token and the user should be
created.
--
Matías Aguirre (matias...@gmail.com)
Message has been deleted

Esteban Quintero

unread,
Nov 14, 2012, 9:04:29 AM11/14/12
to django-so...@googlegroups.com

this  is my code.

urls.py

url(r'^auth/(?P<backend>[^/]+)/$','login.views.register_by_access_token'),


views.py

@dsa_view()
def register_by_access_token(request, backend, *args, **kwargs):
    access_token = request.GET['access_token']
    user = backend.do_auth(access_token)
    if user and user.is_active:
        login(request, user)
    return redirect('/')

This is the URL to call:



but not creating the user, I do something wrong?

Thanks!!

Matías Aguirre

unread,
Nov 15, 2012, 11:03:03 AM11/15/12
to django-social-auth
Doesn't seems that you are doing something wrong, no errors or exceptions?

Excerpts from Esteban Quintero's message of 2012-11-14 12:04:29 -0200:
--
Matías Aguirre (matias...@gmail.com)

Esteban Quintero

unread,
Feb 21, 2013, 2:55:10 PM2/21/13
to django-so...@googlegroups.com
Hello.

yes , this is the error:

No handlers could be found for logger "SocialAuth"

Thanks!
Reply all
Reply to author
Forward
0 new messages