pusher / pusher/pusher-websocket-react-native
Got Error: 'Invalid signature: Expected HMAC SHA256 hex digest' on authenticating user for private channel
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 76
- Forks
- 64
- PR merge metrics
- No merged PRs in 30d
Description
The error i got on pusher debug console
here's my code
async function iniPusher() {
const pusher = Pusher.getInstance();
await pusher.init({
apiKey: '',
cluster: 'ap2',
authEndpoint: `https://domain.com/api/v1/pusher/user-auth/${auth.user.id}`,
});
await pusher.connect();
await pusher.subscribe({
channelName: 'private-chat.' + auth.user.id,
onEvent: event => {
console.log(`Event received: ${event}`);
const formattedData = formatEventData(event);
setMessages(previousMessages =>
GiftedChat.append(previousMessages, formattedData),
);
},
onConnectionStateChange(currentState) {
console.log(`Connection: ${currentState}`);
},
onError(message, code, e) {
console.log(`onError: ${message} code: ${code} exception: ${e}`);
},
onSubscriptionSucceeded(channelName, data) {
console.log(`onSubscriptionSucceeded: ${channelName} data: ${data}`);
},
onSubscriptionError(channelName, message, e) {
console.log(
`onSubscriptionError: ${message} channelName: ${channelName} Exception: ${e}`,
);
},
onAuthorizer(channelName, socketId) {
console.log(
`calling onAuthorizer. channelName=${channelName}, socketId=${socketId},`,
);
});
}
response I got from server
{
"auth": "d980932ee394770d0950:50b4795375582e8dceb2a6597b8eab6f2f72c23e25b1ee9aa5fc9de9f2160e3f",
"user_data": "{\"id\":61}"
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the Pusher initialization and private-channel subscription shown in the issue, then compare the auth endpoint response with the SDK's private-channel authentication requirements. Reproduce the subscription using the reported channel and response; done means authentication succeeds without the invalid HMAC signature error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- authentication, mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100