-
Notifications
You must be signed in to change notification settings - Fork 402
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
Heartbeat API Failing with 403 Error Post PubNub Access Manager Migration to v3 – Invalid Token Signature #431
Comments
@vinaybongale thank you for reaching out to us. Warning I've edited your message because one of the keys from the keyset has been leaked (if it is a test keyset - not a problem then). Access token returned by server is not JWT, but CBOR encoded data which can be parsed for debug purpose with one of used languages. JS has console.dir(pubnub.parseToken("qEF2AkF0GmeGO7JDdHRsGQWgQ3Jlc6VEY2hhbqFmMjEzNi4qA0NncnCgQ3NwY6BDdXNyoER1dWlkoENwYXSlRGNoYW6gQ2dycKBDc3BjoEN1c3KgRHV1aWSgRG1ldGGgRHV1aWR4JGY1ZjRiYzc4LTA5ODgtNDM3NS04ODdlLTkyODgzZjk3YjFjZENzaWdYIDWEOHvZrcTpiRX86DTc-yDuGL3HMgLgBuZnAoX1swZx"), {depth: 20}); Ruby has puts @pubnub.parse_token("qEF2AkF0GmeGO7JDdHRsGQWgQ3Jlc6VEY2hhbqFmMjEzNi4qA0NncnCgQ3NwY6BDdXNyoER1dWlkoENwYXSlRGNoYW6gQ2dycKBDc3BjoEN1c3KgRHV1aWSgRG1ldGGgRHV1aWR4JGY1ZjRiYzc4LTA5ODgtNDM3NS04ODdlLTkyODgzZjk3YjFjZENzaWdYIDWEOHvZrcTpiRX86DTc-yDuGL3HMgLgBuZnAoX1swZx") When parsed it looks like this: {
version: 2,
timestamp: 1736850354,
ttl: 1440,
authorized_uuid: 'f5f4bc78-0988-4375-887e-92883f97b1cd',
signature: Buffer(32) [Uint8Array] [
53, 132, 56, 123, 217, 173, 196, 233,
137, 21, 252, 232, 52, 220, 251, 32,
238, 24, 189, 199, 50, 2, 224, 6,
230, 103, 2, 133, 245, 179, 6, 113
],
resources: {
channels: {
'2136.*': {
read: true,
write: true,
manage: false,
delete: false,
get: false,
update: false,
join: false
}
}
}
} Which theoretically could match your need, but because |
Thank you for the suggestion to use pattern matching for permissions while generating the token and thanks for editing the message for leaked key. We implemented the recommended changes, and the token is now working as expected. Additionally, the heartbeat API issue has been resolved. To provide more context, we are using PubNub features to show the icons of users visiting the same worksheet page on the worksheet UI. Based on this, I have a couple of follow-up questions:
Thank you for your guidance, and please let me know if you need any additional information to assist with these issues |
@vinaybongale I'm glad to hear that permission issues have been resolved. For followup questions:
|
Thank you for the clarification and for addressing both of my questions. I appreciate the confirmation that the behavior of the heartbeat API is expected and the explanation regarding the separation of PAM and Presence APIs. Additionally, I understand that the implementation of user icons needs to be handled on our side, and I will look into ensuring we correctly use presence listeners as suggested. Thanks again for your support! |
I am in the process of migrating from PubNub Access Manager v2 to v3 and encountering multiple issues related to token generation and validation. Below are the steps and changes I've made so far, along with the observed issues:
Changes Implemented:
Server-Side (Ruby):
grant_token
instead ofgrant
.auth_key
as it is no longer required.Frontend Client (JavaScript/TypeScript):
The
connect
method is a public method of thePubNubTransport
class. Below is the constructor for the class wherePubNubConstructor
is defined which is used to above connection code to initialize PubNub:Observed Issues:
1. Heartbeat API Failure:
403 Forbidden
error, as shown below:2. Invalid Token Signature:
Questions:
grant_token
API need any specific permissions for heartbeat to work correctly?Thank you for your guidance! Let me know if you need more details.
The text was updated successfully, but these errors were encountered: