Django djoser 401/400 for creating users - heroku

I deployed a nuxt app to heroku and when I am running it locally, the app is working fine. On the other hand in production the login / register is not working it is always says 400 bad request (there is no explaination why it is a bad request) or 401 unauthorized.
When I am running the up locally, I am pointing to the backend api and it is working fine.
But when it is run in heroku, I get the errors (400 and sometimes 401), oddly it's worked like there random times from different devices but when I logged out and retry create a user errors.
I did not change the code.
I am not sure the problem is with my code or heroku or maybe Pythonanywhere which I am using to host my backend.
It is my first time deploy python DRF as backend and nuxt as front.
My backend is in python DRF.
My front-end nuxt repo nuxt repo
My DRF code backend repo.
In the nuxt app you can see register component with function onSubmit which should register the user and then log him in.
And DRF there is an app name users_auth which has the user model as CustomUser and the Todo model.
nuxt.config.js points to the same place locally and in production.

Related

Getting server error when deploy a MERN app to Heroku

Fail to load resource: server 503(service unavailable)
First thing, I am not sure whether I had set up the port correctly. My React frontend is running on localhost:3000 while my Express backend is running on localhost:3001
This is my .env file.
enter image description here
This is my server.js.
enter image description here
On the frontend side, whenever doing a HTTP request, I use Axios, the endpoint url is "http://localhost:3001/app/Member", something like that. I already had a MongoDB Atlas connected with the app, it is working perfectly on localhost:3001, but I have problem trying to deploy it to Heroku. Some people said there is connection problem between MongoDB Atlas and Heroku, they suggest using the MongoDB sandbox in Heroku to solve this problem, but I already have the database with all the data that I want to used with the app, is there any way that I can import the data from my database to the MongoDB sandbox?
I tried to use "heroku local" to test whether is working, the app is running on localhost:5000, I can see my signup and login page, but I am not able to signup or login with a user email and password like I did perfectly on development mode localhost:3000.
I deployed it to heroku live, it gave me a server 503 error(service unavailable). I logged out the error.enter image description here

laravel breeze doesn't work in production?

I made my first laravel project using Breeze authentification (laravel 9.2).
Everything is ok in local, I can register and login users.
But unfortunately in production on my server, login form and register form don't work so well !
I made a second laravel project, with only authentification functionnality to check if the problem come from part of my app. But the problem repeats : nice in local, does'nt work in production... I don't understand why.
When I submit my new created user or login with an existing user, the form reloads without performing the action...
I have this 404 error in my network console :
POST https://www.prod-breeze.yannpollet.fr/register [HTTP/2 404 Not Found 411ms]
My route login or register exists of course, created automatically with breeze installation.
I read in some forum that Breeze doesn't support https, but i can't believe it.
Anyone has the same problem or know hot to resolve it ?

Why Laravel Sanctum returns always 404

I use Laravel with a Vue SPA. The application runs very well sins a half year.
Now, we need a new instance for further tests. The new instance is on the same server as the dev. I like to continue to use dev and if it works, to deploy with deployer to the test instance. So, the new root is current/public
I deployed the application. The start page (login) works. But then, the csrf request returns a 404.
I changed the .env file to the new domain. I checked it twice.
Then i searched in google for other solutions, no way.
I cleaned cache, routes and config. No better result. I checked the store in the browser. Everything looks ok. The session cookie and als the xsrf token are there.
Is it possible, that the server doesn't accept any header? It's an nginx
Actually I have no Idea to where I have to searcht....

nuxt js, laravel, token is not provided

i'm a learning nuxt js and laravel, I have been doing an api with laravel and the front with nuxt js, when i work on localhost everything works fine but when i upload my api to a remote server the error appears on my nuxt app {"error":"Token is no provided"} this only happens when the api is on the remote server
my nuxt config looks like this
everything works fine on localhost, but not on the remote server, and on the internet I hardly find any information about it, thanks
in my laravel authController i have this

connect nuxtJS with laravel

I'm new in LARAVEL and nuxtJS, So sorry for my question if it somehow silly. I'm working on a project that developed by anthor one. There is no implementation. The client gave me two folder one for frontend developed by nuxtJS and one for backend developed by laravel.
I tried to run a project. But I fails. Could anyone to help me in that. I installed npm for nuxtJS and composer for laravel.
please ask me for anypart of a code which can help. And I'll post it
Thak you.
Assuming Laravel is intended as an API, treat each folder as a separate app. Startup your nuxt application like any other nuxt application. Startup your Laravel application like any other Laravel application. Then using axios or some other fetch library inside your nuxt app, make requests to your Laravel url.
Say you have nuxt running on http://localhost:3000 and you have Laravel running on https://localhost:8000. Inside your nuxt app, where you need to connect to Larvel, you can use axios to get access to your data from Laravel (e.g. axios.get('http://localhost:8000/api/some/resource'))
The docs on asyncData has a good example of making API calls https://nuxtjs.org/guide/async-data

Resources