laravel fortify sanctum SPA issues on forge - laravel

My setup is working properly locally but apparently I'm getting a 401 issue on laravel forge for my laravel-fortify-sanctum
basically I use laravel fortify for authentication then sanctum to get a token after authentication process.
it works properly on my local setup but in laravel forge it's saying I'm still Unaunthenticated
laravel forge domains
api.domain.com
frontend.domain.com
SESSION_DRIVER=cookie
SESSION_DOMAIN=.domain.com
SANCTUM_STATEFUL_DOMAINS=*.domain.com
Am I missing something?

Related

Sanctum not working with subdomain SPA with vue3

i am using sanctum with multiple subdomain dynamically created on user creation but when I am using test.localhost/project_name subdomain sanctum auth not working but when i am using localhost/project_name its working fine. i have added
SESSION_DOMAIN=.localhost
SANCTUM_STATEFUL_DOMAINS=umer.localhost:8000,umer.localhost:3000
but no any solution got. if you have any solution please share with me.

Laravel Passport error when login, use together with Laravel Socialite

I'm building 2 apps which 1 for the OAuth by using Laravel Passport and another app is using the Laravel Socialite with the Provider from https://socialiteproviders.com/Laravel-Passport/
I have set up all the route and have ran passport:install
And at the second application, I have install Laravel Socialite with provider.
Provider settings are also set in config and .env file
But when I try to login, it show error as below, but I confirm that I can login normally using web in OAuth application
Client error: `POST http://localhost:8002/oauth/token` resulted in a `401 Unauthorized` response: {"error":"invalid_client","error_description":"Client authentication failed","message":"Client authentication failed"}
What am I missing? Any help is appreciated.

Upload Image Using Laravel Api with Auth Token Passport

I have uploaded an image from the postman with form-data using passport token. but it gave me an error.
How can I solve this problem. I have tried all solutions but it can't work.
Header with Bearer Token and Route with auth:api middleware.
It's resolved by changing the PHP version. it's not working with the host when the PHP version is <= 7.3.15, its only works with IP. when updating the greater PHP version it's working in both(IP and host).

Using Laravel sanctum for Laravel default authentication returns 419 error code

I am using Laravel Sanctum for making authentication. I don't have any SPA application and I want to have Laravel Sanctum for having default authentication.
I have followed the documentation but I've got 419 error code.
If you try to logging to system with Cookie Base application you should add CSRF to your application. And you do not have to use Laravel/Sanctum package if you will not separate your application parts with wildcards. Just use sessions instead of it.

How to use Laravel passport if default Laravel auth is not being used

I am using laravel 5.4 and not using the default Auth for user authentication with it.
I have created a custom users table and using it with a custom Auth system having all custom middlewares etc.
I have thus not run the command php artisan make:auth or php aritsan migrate in the initial setup.
How i I integrate the project with Laravel/Passport for API authentication ? Also how do I issue tokens with passport if the default auth is not used not even Auth::attempt();

Resources