Laravel Passport 404

2020-07-22 17:57发布

I installed Laravel Passport using the Laravel docs, the Laravel version is 5.4.

Everything worked fine so far now I add these lines into my view:

      <!-- let people make clients -->
      <passport-clients></passport-clients>

      <!-- list of clients people have authorized to access our account -->
      <passport-authorized-clients></passport-authorized-clients>

      <!-- make it simple to generate a token right in the UI to play with -->
      <passport-personal-access-tokens></passport-personal-access-tokens>

The Ui looks good, but if I try to add a new Client or Token I get this message:

Whoops! Something went wrong!

Something went wrong. Please try again.

And my Chrome dev console shows me following:

GET http://192.168.3.80/oauth/tokens 404 (Not Found) app.js:1175
GET http://192.168.3.80/oauth/personal-access-tokens 404 (Not Found) app.js:1175
GET http://192.168.3.80/oauth/scopes 404 (Not Found) app.js:1175

I followed the steps writing in the docs: https://laravel.com/docs/5.4/passport

Afterwards I followed the steps at the video which are the same but it still does not work. https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13

If I press on a button I get this post error in the dev console:

POST http://localhost/oauth/clients 404 (Not Found) POST http://localhost/oauth/clients 404 (Not Found) POST http://localhost/oauth/clients 404 (Not Found)

So it is due to the path?

The vue file shows this:

Clients.vue

        store() {
            this.persistClient(
                'post', '/oauth/clients',
                this.createForm, '#modal-create-client'
            );
        },

2条回答
该账号已被封号
2楼-- · 2020-07-22 18:34

Side-channel communication (IRC) showed that Laravel was installed in a subpath (http://192.168.3.80/myapp/public/), and the urls assume that the application is in the root.

The solution is to change your webserver configuration and set the root (nginx) or DocumentRoot (apache) to Laravel's public folder.

查看更多
够拽才男人
3楼-- · 2020-07-22 18:52

add .. before the url "/oauth/personal-access-tokens" as "../oauth/personal-access-tokens" and do same for other urls also it will work on laravel 5.8

查看更多
登录 后发表回答