charles-vdulac / django-roa

Fork of original Django ROA lib. Now ROA works directly with an API like Django Rest Framework
BSD 3-Clause "New" or "Revised" License
51 stars 25 forks source link

How to authenticate with external client? #9

Closed thedrow closed 10 years ago

thedrow commented 10 years ago

Is there an authentication mechanism for django-roa?

JocelynDelalande commented 10 years ago

Could you be more specific ?

charles-vdulac commented 10 years ago

I implemented with success OAuth2 auth. Here a sample of code:

    header = {'Authorization': 'Bearer {}'.format(access_token)}

    # Save new access token to session and in current thread
    set_roa_headers(request, header)

Is it your question ?

thedrow commented 10 years ago

And if it's in the query string?

charles-vdulac commented 10 years ago

If your auth data are shared by every user, you can set settings.ROA_CUSTOM_ARGS (http://code.larlet.fr/django-roa/wiki/Development#!developing-with-django-roa).

If not, we have to implement a process like set_roa_headers/get_roa_headers which stores data in user session.