Log all authentication errors Laravel (nova) - laravel

I am building an api and my post request return the following message
{"message":"Unauthenticated."}
This messsage is quite unclear. I would like to log more info about the Laravel passport authentication attempts.
I would like to log them to
/storage/logs
Question:
Is it possible to log detailed Auth error messages into the storage log folder?

In your Laravel exception handler file create a custom handler for the
exception that is being thrown that logs more information. On the
OAuthServerException you can call getHint() to get a more specific
error.
References :
I hope Reading following laravel passport github issues will help you
https://github.com/laravel/passport/issues/403
https://github.com/laravel/passport/issues/289

Related

Laravel 9 to home page redirected

I'm starting in Laravel, and I'm using Laravel 9, I'm making an API, starting for a User CRUD, when I register the user, everything it's ok, but when I got some error, example if I try to register the same email or wrong login data, the API show me the home Laravelpage, instead of to show me some error at JSON format
User registered succefully
User doesn't registered succefully
I'm trying to handle the error, I would like to get some JSON messages showing what's wrong or what happened
I have resolved the problem, I was using Postman, and you need to add at header Accept = application/json

zapier basics AUTH failed while connecting it to my Laravel app (caltweets)

I want to integrate zapier into my laravel app(caltweets) but when I'm adding the information in the zapier and try to test my Authentication. It says we are hitting an error while adding your new account.
[this is the error ]
[1]: https://i.stack.imgur.com/UAPIB.png
[this is the domain that I'm entering ]
[2]: https://i.stack.imgur.com/urMSm.png
[here I'm testing]
[3]: https://i.stack.imgur.com/biGT9.png
The issue here is on your server's side. Zapier is making a request to 'https://abhi.businessscheduler.com//login', but your server isn't handling it correctly (and giving a 500 error). Check your logs to see the actual error. You can likely handle the error from Zapier better.

Laravel Socialite Twitter Provider - Could not authenticate

I'm using Laravel Socialite in a project and added the Twitter Provider in order to be able to allow my users to integrate with their Twitter account. I followed the steps here https://socialiteproviders.com/Twitter/ and I'm getting the following error:
Received HTTP status code [401] with message "{"errors":[{"code":32,"message":"Could not authenticate you."}]}" when getting temporary credentials.
If I leave the TWITTER_REDIRECT_URI in my env file blank, the error goes away and the Oauth flow works exactly as it's supposed to. Is anyone else having this issue? If the TWITTER_REDIRECT_URI isn't needed why have it in the docs?

Django-allauth + reactjs+ linkedin login redirect uri issue + Not enough permissions to access: GET /me

I am using drf + ReactJs to do social login am able to integrate google login and facebook login using django allauth package , but when I tried to integrate linkedin login getting error :
invalid redirect uri
TO be more precise am getting this error
allauth.socialaccount.providers.oauth2.client.OAuth2Error: Error retrieving access token: b'{"error":"invalid_redirect_uri","error_description":"Unable to retrieve access token: appid/redirect uri/code verifier does not match authorization code. Or authorization code expired. Or external member binding exists"}
----few updates after tying out few fixes -----
Tried fetching the access token from backend and login the user using a seprate api it showed the redirect uri issue.
Tried directly calling the linkedin token url from postman and now I get Invalid request error.
First method worked after few tryouts but now getting incorrect value error.
Tried fetching code with scope as r_liteprofile but now getting 403 forbidden
{'serviceErrorCode': 100, 'message': 'Not enough permissions to access: GET /me', 'status': 403}
I tried changing url to backend and frontend both showing same error. Can anyone get me how to fix this issue ?
I am not sure what all additional details needed for sorting this out, Please let me know if any needed.
Finally able to find the solution
the issue was with the code generated from the sdk used to implement linkedin login in reactjs, which has only scope
r_emailaddress
r_liteprofile
Adding additional scope
w_member_social
And regarding redirect uri issue
we are suppose to use the same redirect uri in both frontend and backend
made things working , posting this here since it will help someone in future facing same problem.
thank you all

Laravel 5 broadcast authentication endpoint route not working. JSON returned from webapp was invalid

i'm trying to set up my private channel broadcast via Pusher. I've done all, that Laravel broadcasting documentation says. When Pusher is trying to authorize the user - authorization page returns 403 error with HttpException:
I was searching a lot and found one solution, to change the BroadcastServiceProvider this way:
Broadcast::routes(['middleware' => ['auth:api']]);
And now i get 302 redirect to login page and then to main page. Pusher error log now:
JSON returned from webapp was invalid, yet status code was 200. [my main page html here, no json at all]
Configuration files are all set, including Echo
Broadcast service providers are uncommented in config/app.php
I cant find the solution for this problems in simmilart StackOverflow questions.
change the BROADCAST_DRIVER=log
to
BROADCAST_DRIVER=pusher

Resources