How to use API Auth using Django MongoEngine REST? - django

I'm building an API REST using Django and MongoDB with django-rest-framework-mongoengine package from https://github.com/umutbozkurt/django-rest-framework-mongoengine
How can I use Django Rest Framework API TokenAuthentication if this package does not use Django's built in ORM ?

I solve it by handling TokenAuthentication or any other type of DRF auth using Django's build in ORM with MySQL database (Just to handle API authentication). I use MongoDB as my primary system database. So yes, i'm using two databases, one for auth API and the other for transactions.
Don't know if this is the best way to achieve this but it works.
I hope this helps to anyone who's trying or thinking to work with this architecture :)

Related

Can I use django as frontend and have a login system with Token Authentication

Well, this question is for the ones who has experience in working with Django.
I'm new to Django and I have been studying Django, still I want to build an webapi with Django as backend and frontend, with a token authentication. Is that possible, and logical? I have been watching tutorial and reading documentation. Everyone who creates an api full django, creates a basic authentication. And, I want to know if is possible to create a more secure authentication with django as frontend. Thank you.
Generally speaking: yes, you can do that - but not with django alone. Also don't know every possible solution, but you can do this with the Django REST framework.
Here are some links to the documentation:
Django REST framework - Homepage
Django REST framework - TokenAuthentication
I personally use JSON Web Tokens in combination with Django and Django REST framework:
Simple JWT

Django rest framework and frontend

I want to use Django Rest Framework to create RESTAPI to integrate with the payment gateway API like stripe. For the frontend part I can only see project using React for the frontend. Cant i use Django as a frontend?
Looking for suggestions if i really just need to use React or Vue. Or is it possible to use django as frontend as well.
Looking for your suggestions. Thank you.
To use Stripe in Django, you may refer to this package https://github.com/dj-stripe/dj-stripe which supports Stripe out-of-the box specific for Django
For replacing React with Django for front-end, it is possible and you can use Django template, however, it depends on your use-case.

django REST ldap authentication with Cassandra

I am writing a rest api using django rest framework. I store my data in Cassandra. I am using django-cassandra-engine as my backend. My api works fine, but now I need add LDAP authentication.
I intend to use this package called django-auth-ldap. From what I understand django-cassandra-engine doesn't support django-auth module on which django-auth-ldap rely on?
I have never worked with Cassandra before, and I consider myself a Django newbie.
Can someone be so kind and give me few hints how can I do this? Much appreciated.
Thanks in advance!

Stormpath for Django Rest Framework

We are using Django Rest Framework to build API's that feed AngularJS apps. The intent is to use Stormpath for oauth2 authentication and for storage of backend authorization information. However, all of the examples that I have found using Stormpath with Django are for Django web pages (not REST API's) using username and password, not tokens.
How do you integrate Django REST Framework authentication with Stormpath using oauth2?
In this case, you'll actually be relying on Django Rest Framework for the OAuth2 support -- not Stormpath at all. Stormpath will only provide the User model that DRF uses in the backend -- nothing more.
This was a design decision we made to help simplify the data model.
I'm currently looking into ways to add OAuth2 as a first-class Stormpath feature in Django, but that's a ways down the line currently.

How to create simple restful login system in django?

I want to create simple restful login system in django. I searched every where they are creating rest-full login system using Restful Framework. How to create without using any rest framework.
Though the default authentication views in Django are not RESTful, you can use third party addons that extend the default views.
Djoser works with Django Rest Framework and provides most of the endpoints for login system.
You can find the other options that work with most Django REST frameworks here: http://www.django-rest-framework.org/api-guide/authentication/#third-party-packages