Im trying to authenticate a private broadcast using the following React Native script.
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Pusher from 'pusher-js/react-native';
export default class App extends React.Component {
componentWillMount() {
Pusher.logToConsole = true;
var pusher = new Pusher('*********', {
authEndpoint: 'http://app.pgm/api/authtest',
cluster: 'eu',
encrypted: true
});
const channel = pusher.subscribe('private-chat-1');
}
The above is being posted to the function below, the function below returns an auth token when tested from Postman. However when I run the app through React Native I get the following response.
public function pusher(Request $request){
$pusher = new Pusher(config('broadcasting.connections.pusher.key'), config('broadcasting.connections.pusher.secret'), config('broadcasting.connections.pusher.app_id'));
echo $pusher->socket_auth($request->channel_name, $request->socket_id);
}
[exp] Pusher : Couldn't retrieve authentication info. 0Clients must be authenticated to join private or presence channels. See: https://pusher.com/docs/authenticating_users [exp] Pusher : No callbacks on private-chat-1 for pusher:subscription_error
It leads me to think Laravel isn't receiving the post data. I do not currently have any middleware that could block the request.
Can anyone see where I am going wrong?