user3441799
user3441799

Reputation:

Django with oauth2 for REST API

I created project for ORM based web service API calls for my iOS application, I want to call each API calls in secure way. I chose REST framework with oAuth2 for access token creation. I surfed in google to find a best tutorial for creating secure API calls , but nothing helped me to resolve my problem. What i done so far is,

Python with Django project and application created. Created model and views for my application.

Need help and guidance for secure API calls to GET,POST my datas.

Upvotes: 1

Views: 852

Answers (1)

Prateek099
Prateek099

Reputation: 549

You can make secure the api calls by passing the access-token with every get or post request.The access-token can be send either through query-params or with the HTTP_AUTHORISATION_HEADER.Also use TokenAuthentication for verifying the access-token validity. For setting TokenAuthentication as default for all api calls add the given line to settings file:

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
    'rest_framework.authentication.TokenAuthentication',
)
}

For using default settings send token as:

Authorisation : Token #211341342

Upvotes: 1

Related Questions