-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
When using broadcasting, /broadcasting/auth returns 500 if authenticatable model that is not eloquent does not implement getKey #18343
Comments
Well, if your class implements I do not think it's supported to have a class which implements |
@jerguslejko absolutely you can. We do. We utilize Propel for our model classes and we've implemented the Authenticatable contract per documentation at https://laravel.com/docs/5.4/authentication#the-authenticatable-contract . That works great. For reference, the Authenticatable contract interface documentation is here: https://laravel.com/api/5.4/Illuminate/Contracts/Auth/Authenticatable.html . There is no mention of getKey or getKeyName. |
And I don't know what you are talking about regarding Illuminate\Auth\Authenticatable. There is no such class/interface. You might be confused with the use alias that is inside the default User.php in the laravel/laravel package. Anyways, my recommendation in resolving this is to replace the getKey references in the Broadcasters with getAuthIdentifier() . This is meant to be unique per Authenticatable documentation and is suitable for Broadcaster purposes. |
@tdondich oh I get you now. Yeah, you are right. I was looking at I guess calls in: need to change as you're suggesting. |
I'll create a pull request. |
Thanks @jerguslejko . Appreciate the back and forth. Maybe we can merge in that PR? First time contributing to the project, so want to do it right. Let me know if I need to change anything per process. |
It's not up to us. You'll need to wait for Taylor to review the change. |
It's okay. I'm on a first name basis with him. Get it? Get it? |
Closing since the PR was merged. Thanks :) |
Description:
When implementing a Authenticatable for authentication, if the implementation does not also implement getKey, then usage of Event Broadcasting will fail.
The getKey method on the Authenticated user is called in PusherBroadcaster.php in method validAuthenticationResponse as well as RedisBroadcaster.php.
Steps To Reproduce:
Implement a bare bones class that implements Authenticatable then call Auth::login with this instance. Enable Broadcasting per documentation. Attempt to call join or private (to attempt to call /broadcasting/auth). Server response is 500 due to no method getKey on the Authenticated user.
The text was updated successfully, but these errors were encountered: