Hello,
Need some help, please.
I followed the tutorial What's New in Laravel 5.3: Laravel Passport (https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13) step by step and i have this error:
ServerException in RequestException.php line 107: Server error: POST http://latest.dev/oauth/token resulted in a 500 Internal Server Error response: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'consumer.oauth_clients' doesn't exist (SQL: select * from `oa (truncated...)

latest.dev

consumer.dev

The error is right there in the stacktrace.
Base table or view not found: 1146 Table 'consumer.oauth_clients'
That mean's your latest.dev project either has a bad database connection, or you never ran the migrations in that project. Could you double check those things and then hopefully we can figure out your problem. More than likely, you have the wrong database selected. In your photos above, you show clients in latest.dev but your error says your using the consumer database, is that correct?
I made sure that latest.dev project has the required migrations & specifically oauth_clients table .. But the error says that it looks for oauth_clients table in consumer.dev & not latest.dev which is unlogical I think ..
& Yes It's correct as you said "Clients are in latest.dev but the error looks for clients in consumer database" despite that when adding a new client It successfully register the clients in the database of latest.dev
I'll set up a 2 projects and see if I can replicate it, but in the mean time, why is client_secret empty in your /callback route?
Sorry the photo is a little old but client_secret was already fixed before & still there is an error :(

Hey @HassanMahmoudd,
So I went through the video and followed along like you said you had done, but no errors occurred. What versions are you using for Passport and Laravel? All your code shown seems to be correct to me, which leads me to believe it's a configuration error.
Perhaps you can post the entire stack trace and that might have some clues? Also if you could, post the DB_* env variables from both projects.
Here are latest.dev DB_* variables

Here are consumer.dev DB_* variables

No problem, hopefully you can find out what you did wrong. Also, it's very weird to me that the error was with a database called consumer but yet your DB_DATABASE for consumer is called testconsumer. Hmm... either way, here are the repo's @HassanMahmoudd
https://github.com/craigpaul/provider-issue-example
https://github.com/craigpaul/consumer-issue-example
Hei @HassanMahmoudd, are your problem solve ? I also have problem like you
@craigpaul I tried to drop the "consumer" database & make a new one called "testconsumer" that's why they are different but the problem isn't there & I also pulled your both projects & tested them but the same error happened again .. @danielistyo No the problem is still there
@HassanMahmoudd, Okay thanks. I solve my problem using 2 laptops. I separate server and consumer in difference laptops.
@danielistyo Thanks a lot you are right now problem is solved .. Also the server and the consumer can be on the same computer but they must access different ports for example the server is on localhost:9000 & the consumer is on localhost:9999 .. I tried that & It worked
@HassanMahmoudd, ah, didn't realize you were using that kind of setup. I assumed it was inside a VM. Either way, if you've got it all fixed up, could you close the issue? Thanks!!
Hi this is not a big issue just to implement it on server you must
Run the following command
php artisan serve
and replace the paths passport.dev to http://127.0.0.1:8000
and try again then it will work
@danielistyo Thanks a lot you are right now problem is solved .. Also the server and the consumer can be on the same computer but they must access different ports for example the server is on localhost:9000 & the consumer is on localhost:9999 .. I tried that & It worked
Hai @HassanMahmoudd , I faced same problem here. I could solve if I run php artisan serve like @zohaib055 . Later I tried with your solve by configuring my XAMPP (Apache vhost with different port), however the problem persists although I'm using different port like you said. Does it need to be configured more specific in Apache config maybe ?
Anyway I don't try yet the @danielistyo solution (Need buy more laptop 😄 )
Need your advise guys
Thanks
I have the some error but only in windows, in my osx run perfectly. Did you find the solution for this?
I have the some error but only in windows, in my osx run perfectly. Did you find the solution for this?
Hi guys.
I had the same problem, but when I copied the database settings that were in .env to config/database.php and ran the php artisan config:cache command it worked. I am using two applications on the same notebook, one on port 7305 and one on port 7309 using windows and xampp.
@raulfdias thank you it's also work for me
Most helpful comment
Hi guys.
I had the same problem, but when I copied the database settings that were in
.envtoconfig/database.phpand ran thephp artisan config:cachecommand it worked. I am using two applications on the same notebook, one on port 7305 and one on port 7309 using windows and xampp.