Skip to content

getFilesUrl is missing auth when using Access Manager v3 #103

Open
@vsomayaji

Description

@vsomayaji

The first step in migrating from Access Manager v2 to v3 is to remove the authKey from the client-side configuration. When you do that, URLs returned by getFilesUrl start failing with an HTTP 403 error.

It looks like the issue lies here:

if (keyset.authKey != null) 'auth': keyset.authKey!

With the PamKeysetExtension, should that be something like this instead:

if (keyset.hasAuth()) 'auth': keyset.getAuth(),

For now, we're working around this by setting the authKey to the token:

    _pubnub = pn.PubNub(
      defaultKeyset: pn.Keyset(
        // TODO: Setting the `authKey` shouldn't be necessary, but there is a bug in the PubNub SDK where
        // [PubNub.files.getFileUrl] does not use the value configured with [PubNub.setToken].
        authKey: token,
        publishKey: publishKey,
        subscribeKey: subscribeKey,
        userId: pn.UserId(userId),
      ),
    );
    _pubnub.setToken(token);

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue is accepted as valid, but it's not being worked on yet.type: bugThis issue reports a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions