Issues with social login with vuejs and django-rest-auth - django

I am working with APIs for the first time and was looking at how to set up social app authentication for the project. I have django-rest-auth set up for the backend that basically uses the django allauth framework. So when I pass an access token to the backend using the API view, it works.
Now that I have moved to vuejs for the front end, I am absolutely clueless on how to make it work with my API.
Any help would be greatly appreciated. I'm a total beginner for vuejs and have been working on django framework for a bit more than a month. Thanks in advance!
My URL settings in VueJS:
The error I get is:

Cross origin content is blocked by same origin policy. Use https://github.com/ottoyiu/django-cors-headers to allow cross origin access. If you are interested in details https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

Related

How to intergarte react native front end with django backend

Post Method Used In ReactNative
Error raised
Forbidden: /api/login/
I created a user API using djangorest framework and it is functioning well, however i dont know how to add it to my react native front end for authentication. I would like users to login and the drf to authenticate them. Is there a tutorial i can follow, i tried to look at a few but they didnt work for me. I'm new to react native. Would appreciate elaborate answers and shared resources
Currently using expo cli and unable to fetch data from drf(django rest framework).
is there a way i can request my post method to use djangosessions for authentication instead of auth tokens
the method in the image only works if
'rest_framework.authentication.SessionAuthentication',
is disabled and this is used to get data in api so it cannot be excluded
welcome to ReactNative
You can use different libraries to handle an api request.
Take a look at axios:
https://github.com/axios/axios

Django REST authentication with React/ Redux

I am building a web app with a Django backend and React/Redux frontend running on separate servers. I have begun to try and start working on authentication and I cannot find a tutorial that suits my needs. Every tutorial either uses deprecated modules like drf-jwt (as opposed to simple-jwt) or has a simple mono-server that houses both the backend and the frontend in one directory. The former is useless and I do not want to do the latter as I like having the two separate servers for when I move on to deployment. Now can someone direct me to a good source of knowledge for getting this done? It doesn't have to be a tutorial it can be anything. I am really lost and I do not know how to begin.
you can use 3rd party packages djoser: Provides a set of views to handle basic actions such as registration, login, logout, password reset and account activation. for more information: https://pypi.org/project/djoser/
I'm using token authentication from Django Rest Framework so, after a login/password verification, the token on response can be used on any DRF endpoint.

User authentication with Django and NextJS

I am building a project that uses Django Rest Framework as the backend and NextJS serves React frontend. How can I integrate user authentication using these two technologies?
In the future we might build a mobile app as well, so we need the backend to be consistent.
Thank you for your time.
I would suggest using the JWT tokens for authentication. You will not face any problem if you change your frontend. To get an idea on implementation, check this answer - https://stackoverflow.com/a/62112041/12840065

Sharing authentication in Django

we are developing an application using Angular2 as frontend and Django as a backend. A Django backend is already in place, while the Angular2 application is in development. We chose, for obvious reasons, to use Django REST as a way to communicate with the backend.
The application login and the backend login are done in two different pages but of course the login domain and the user base is the same. The two login are working properly by themselves, but we wanted to find a way to implement a transparent login (so an user can log into any of the two application and be recognized by the other one without re-logging).
The Angular frontend is currently using Token Authentication. The server does send the csfr and session cookie along with the token. Moving to the backend, the csfr cookie is preserved, while the session is not, so a new login is required (of course, backend and Angular frontend are on different subdomains but in the same domain, the cookies are set on the domain, with two dots: '.domain.com') .
Is it possible to do what we desire? Could someone help us find the proper way to do it?
We've done some research and found Django CAS, but it's not clear for us what's about and if it fits our use case.
Thank you very much

Login using Google+ on a Django Site

Hi everyone I want to put a google+ login button on my website (coded in django) w/o using any 3rd party tool like Django-Social-Auth, etc.
So can anyone point me to some tutorial or help me how to do it. I want user to login via Google+ and then I can get their information at backend in django views. I will be then hosting it on Google App Engine so if some GAE API can help me then it will also be great.
I figured out the solution:
Got access_token using https://developers.google.com/+/web/signin/javascript-flow
Then send out the access_token to Server for getting User Details, considering these security measures (https://developers.google.com/+/web/signin/client-to-server-flow).
Use Django CSRF Token functionality to send token safely (https://docs.djangoproject.com/en/dev/ref/contrib/csrf/).