grantToken

expect abstract fun grantToken(ttl: Int, meta: CustomObject? = null, authorizedUUID: String? = null, channels: List<ChannelGrant> = emptyList(), channelGroups: List<ChannelGroupGrant> = emptyList(), uuids: List<UUIDGrant> = emptyList()): GrantToken
actual abstract fun grantToken(ttl: Int, meta: Any?, authorizedUUID: String?, channels: List<ChannelGrant>, channelGroups: List<ChannelGroupGrant>, uuids: List<UUIDGrant>): GrantToken

This function generates a grant token for PubNub Access Manager (PAM).

Permissions can be applied to any of the three type of resources:

  • channels

  • channel groups

  • uuid - metadata associated with particular UUID

Each type of resource have different set of permissions. To know what's possible for each of them check ChannelGrant, ChannelGroupGrant and UUIDGrant.

Parameters

ttl

Time in minutes for which granted permissions are valid.

meta

Additional metadata

authorizedUUID

Single uuid which is authorized to use the token to make API requests to PubNub

channels

List of all channel grants

channelGroups

List of all channel group grants

uuids

List of all uuid grants


abstract fun grantToken(ttl: Int, meta: Any? = null, authorizedUserId: UserId? = null, spacesPermissions: List<SpacePermissions> = emptyList(), usersPermissions: List<UserPermissions> = emptyList()): GrantToken

Deprecated

This function is deprecated. Use the new grantToken(ttl, userId, meta, authorizedUUID, channels, channelGroups, uuids)

Replace with

grantToken(ttl, meta, authorizedUUID, channels, channelGroups, uuids)

This function generates a grant token for PubNub Access Manager (PAM).

Permissions can be applied to any of the two type of resources:

  • spacePermissions

  • userPermissions

Each type of resource have different set of permissions. To know what's possible for each of them check SpacePermissions and UserPermissions.

Parameters

ttl

Time in minutes for which granted permissions are valid.

meta

Additional metadata

authorizedUserId

Single userId which is authorized to use the token to make API requests to PubNub

spacesPermissions

List of all space grants

usersPermissions

List of all userId grants

actual abstract fun grantToken(ttl: Int, meta: CustomObject?, authorizedUUID: String?, channels: List<ChannelGrant>, channelGroups: List<ChannelGroupGrant>, uuids: List<UUIDGrant>): GrantToken