Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Install - 405 on Login #23

Closed
BtotheT opened this issue Mar 15, 2019 · 8 comments
Closed

New Install - 405 on Login #23

BtotheT opened this issue Mar 15, 2019 · 8 comments

Comments

@BtotheT
Copy link

BtotheT commented Mar 15, 2019

On first install (after key gen and config:cache):

php artisan:serve

Attempting to login via default credentials results in a 405 error.

message: "The POST method is not supported for this route. Supported methods: GET, HEAD."

Route: /auth/login

@tuandm
Copy link
Owner

tuandm commented Mar 17, 2019

The correct route should be /api/auth/login, please check if your .env has those lines:

BASE_API=/api
MIX_BASE_API="${BASE_API}"

@budirec
Copy link

budirec commented Apr 2, 2019

I think the issue is the env variable is not available.
Doing console.log(process.env) gives me error
process is undefined

@prawn185
Copy link

prawn185 commented May 5, 2019

@budirec So how would you solve this?

@budirec
Copy link

budirec commented May 5, 2019

For now what I do is hardcode /api in https://github.com/tuandm/laravue/blob/master/resources/js/utils/request.js#L7

But I think there should be better way to fix this, and need to investigate why the env var is not feed to the js

@tuandm
Copy link
Owner

tuandm commented May 5, 2019

That setting is on your .env, please check example in https://github.com/tuandm/laravue/blob/master/.env.example

BASE_API=/api
MIX_BASE_API="${BASE_API}"

This MIX_BASE_API value will be transfered to

  baseURL: process.env.MIX_BASE_API,

Detail here: https://laravel.com/docs/5.8/mix#environment-variables

@budirec
Copy link

budirec commented May 7, 2019

yeah, I have that in my .env but it wasn't available in the js file
process.env is undefined

`
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
BASE_API=/api

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
MIX_BASE_API="${BASE_API}"
MIX_WP_DOMAIN="${WP_DOMAIN}"
`

@fpcimmino
Copy link

fpcimmino commented Jun 4, 2019

I had the same problem.
It worked for me to add BASE_API=/api to my .env and run "npm run dev".

I hope to work for you.

@tuandm
Copy link
Owner

tuandm commented Aug 26, 2020

Changing .env required npm run again

@tuandm tuandm closed this as completed Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants