Laravel backpack authentication middleware auth #1352
Replies: 2 comments
-
🚨 Bot is not sure about this answer. Please verify. 🚨 I'm sorry, but the knowledge sources provided do not contain explicit information about integrating Laravel Echo authentication headers with Backpack's authentication system, or about handling private channel authentication specifically in the context of Backpack's admin guard or middleware. From the sources, we know that Backpack uses its own authentication guard (named backpack) and middleware, which is separate from the default Laravel web or api guards. This means that if your broadcasting/auth route is protected by the web guard, but your Backpack admin is authenticated via the backpack guard, there could be a mismatch causing the 403 error. However, the sources do not provide a step-by-step solution for passing authentication to Echo headers or for configuring Echo to work with Backpack's authentication system. If you need to customize authentication for broadcasting, you may need to ensure that the broadcasting/auth route uses the same guard as your Backpack admin panel, or adjust your middleware accordingly. But again, the knowledge sources do not provide a concrete example or recommended approach for this scenario. If you need more detailed guidance, you may want to consult the Laravel documentation on broadcasting authentication or seek advice in the Backpack community forums, as this specific integration detail is not covered in the provided sources. ℹ️ Please note our AI Bot does not reply to follow-ups, this will be the only AI answer in this thread. If the AI helped you find the answer, please mark it as answered or write details below so it can learn. Then close the conversation. If not, please give more information for when a human reads this. ℹ️ Relevant sources: Github Issue (closed): Force https |
Beta Was this translation helpful? Give feedback.
-
Hello @smzapp, as I understand, this is working now (link). Is that right? Cheers |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Concerning my previous question, I notice that
POST http://localhost:8000/broadcasting/auth 403 (Forbidden)
due to invalid auth being passed. How could I pass the authentication to the Echo header so that it would be authenticated? Since backpack is using web and not api, I could hardly pass it as a stateless token.I am able to send public but not private channel.
#1351 (comment)
window.Echo = new Echo({
broadcaster: 'reverb',
key: import.meta.env.VITE_REVERB_APP_KEY,
wsHost: import.meta.env.VITE_REVERB_HOST,
wsPort: import.meta.env.VITE_REVERB_PORT ?? 80,
wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
enabledTransports: ['ws', 'wss'],
auth: {
headers: {
},
},
});
window.Echo.private(
user
).listen('.MessageSent', (e) => {
console.log('Received message! sample', e.message);
});
Beta Was this translation helpful? Give feedback.
All reactions