Access Manager v3 API for Unity SDK
Access Manager isn't enabled by default
Access Manager allows you to enforce security controls for client access to resources within the PubNub Platform. With Access Manager, your servers can grant their clients tokens with embedded permissions that provide access to individual PubNub resources:
- For a limited period of time.
- Through resource lists or patterns (regular expressions).
- In a single API request, even if permission levels differ (
readtochannel1andwritetochannel2).
You can add the authorizedUuid parameter to the grant request to restrict the token usage to one client with a given userId. Once specified, only this authorizedUuid will be able to use the token to make API requests for the specified resources, according to permissions given in the grant request.
User ID / UUID
User ID is also referred to as UUID/uuid in some APIs and server responses but holds the value of the userId parameter you set during initialization.
Grant token
Requires Access Manager add-on
This method requires that the Access Manager add-on is enabled for your key in the Admin Portal. See Enable the features your app calls.
Requires Secret Key authentication
Granting permissions to resources should be done by administrators whose SDK instance has been initialized with a Secret Key (available on the Admin Portal on your app's keyset).
The GrantToken() method generates a time-limited authorization token with an embedded access control list. The token defines time to live (TTL), AuthorizedUuid, and a set of permissions giving access to one or more resources:
ChannelsChannelGroupsUuids(App Context UUID metadata, such as names or avatars)Users(DataSyncUserobjects)DataSync(DataSync entities, relationships, and memberships)Categories(list all channel or UUID metadata on the subscribe key, not one named resource)
Only this AuthorizedUuid will be able to use the token with the defined permissions. The authorized client will send the token to PubNub with each request until the token's TTL expires. Any unauthorized request or a request made with an invalid token will return a 403 with a respective error message.
- Permissions
- TTL (time to live)
- RegEx patterns
- Authorized UUID
The grant request allows your server to securely grant clients access to resources on the PubNub platform. Each resource type supports a specific set of operations:
| Resource | Permissions |
|---|---|
channels | read, write, get, manage, update, join, delete |
groups | read, manage |
uuids | get, update, delete |
users | create, get, update, delete |
dataSync (entities, relationships, memberships) | create, get, update, delete |
categories (Channels, Uuids) | get only |
In GrantToken(), Categories sets Channels.Get for channel metadata and Uuids.Get for UUID metadata.
- A category permission lets a token list all metadata of one resource type on your subscribe key. Valid categories are
channelsanduuids. The only permission isget(32). - A
getpermission on one named channel or user, or on a pattern, does not grant a category. - A token can contain only categories. It needs no resource or pattern.
- When enumeration enforcement is enabled for a keyset, App Context list requests from a token or auth key without the matching category permission return a
403error.
Setting Get to false leaves the category out of the token.
For a full mapping of permissions to API operations, refer to Manage Permissions with Access Manager v3.
DataSync user and channel objects are protected through the existing Users and Channels resource types, not through a separate DataSync scope. Uuids grants App Context metadata permissions and does not authorize DataSync user operations. Only DataSync entities, relationships, and memberships use the DataSync scope. Refer to DataSync access control for the full permission and resource-type mapping.
read, write, manage, and join stay messaging concepts and are not interpreted on Uuids, Users, or any DataSync resource.
danger
Uuids with UsersUuids and Users serialize to separate token scopes used by different products. The Unity grant builder nevertheless treats them as mutually exclusive across Resources and Patterns: supplying both can throw an ArgumentException or cause Users entries to be omitted with a warning. Use Uuids for App Context metadata grants and Users for DataSync user grants, in separate grant calls when you need both.
The ttl (time to live) parameter defines how many minutes the permissions remain valid. After expiration, the client must get a new token to maintain access.
ttlis required for every grant call.- There is no default value.
- The maximum allowed value is 43,200 (30 days).
For more details, see TTL in Access Manager v3.
Use regular expression (RegEx) patterns to set permissions without listing each resource. Define RegEx permissions for a given resource type in the grant request. Patterns are evaluated on the server using RE2-style syntax; backreferences and lookaround assertions are not supported.
For more details, see RegEx in Access Manager v3.
The AuthorizedUuid parameter restricts token usage to a specific client. Only requests from this UUID are authorized by PubNub. If you do not set AuthorizedUuid, any client with any UUID can use the token. For security, restrict tokens to a single AuthorizedUuid to prevent impersonation.
For more details, see Authorized UUID in Access Manager v3.
Method(s)
1pubnub.GrantToken()
2 .TTL(int)
3 .Meta(Dictionary<string, object>)
4 .AuthorizedUuid(string)
5 .Resources(PNTokenResources)
6 .Patterns(PNTokenPatterns)
7 .Categories(PNTokenCategories)
8 .DataSyncProjections(PNDataSyncProjections)
9 .QueryParam(Dictionary<string,object>)
10 .Execute(System.Action<PNAccessManagerTokenResult, PNStatus>)
| Parameter | Description |
|---|---|
TTL *Type: intDefault: n/a | Total number of minutes for which the token is valid.
|
MetaType: Dictionary <string, object>Default: n/a | Extra metadata to be published with the request. Values must be scalar only; arrays or objects aren't supported. |
AuthorizedUuidType: stringDefault: n/a | Single Uuid which is authorized to use the token to make API requests to PubNub. |
ResourcesType: PNTokenResourcesDefault: n/a | Object containing channel, channel group, UUID metadata, and DataSync permissions. |
PatternsType: PNTokenPatternsDefault: n/a | Object containing permissions to apply to all channel, channel group, UUID metadata, and DataSync resources matching the RegEx pattern. |
CategoriesType: PNTokenCategoriesDefault: n/a | Category grants that let the token list all metadata of a type on the subscribe key. Set Channels.Get to list all channel metadata and Uuids.Get to list all UUID metadata. Categories with Get set to false are omitted from the token. |
DataSyncProjectionsType: PNDataSyncProjectionsDefault: n/a | Object assigning field-level projections to DataSync resources. |
QueryParamType: Dictionary <string, object>Default: n/a | Dictionary object to pass name/value pairs as query string params with PubNub URL request for debug purposes. |
ExecuteType: System.ActionDefault: n/a | System.Action of type PNAccessManagerTokenResult. |
ExecuteAsyncType: None Default: n/a | Returns Task<PNResult<PNAccessManagerTokenResult>>. |
PNTokenResources contains the following properties:
| Parameter | Description |
|---|---|
ChannelsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing channel permissions. |
ChannelGroupsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing channel group permissions. |
UuidsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing App Context UUID metadata permissions. Does not authorize DataSync users and cannot be combined with Users in one grant. |
UsersType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing DataSync user permissions. Cannot be combined with Uuids in one grant. |
DataSyncType: PNDataSyncTokenScopesDefault: n/a | Object containing DataSync resource permissions keyed by exact entity, relationship, or membership id. |
PNTokenPatterns contains the following properties:
| Parameter | Description |
|---|---|
ChannelsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing permissions to apply to all channels matching the RegEx pattern. |
ChannelGroupsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing permissions to apply to all channel groups matching the RegEx pattern. |
UuidsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing App Context UUID metadata permissions for matching IDs. Does not authorize DataSync users and cannot be combined with Users in one grant. |
UsersType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing DataSync user permissions for matching IDs. Cannot be combined with Uuids in one grant. |
DataSyncType: PNDataSyncTokenScopesDefault: n/a | Object containing DataSync resource permissions to apply to all entities, relationships, or memberships matching the RegEx pattern. |
PNDataSyncTokenScopes contains the following properties:
| Parameter | Description |
|---|---|
EntitiesType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing entity permissions keyed by exact id (Resources) or RegEx pattern (Patterns). |
RelationshipsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing relationship permissions keyed by exact id (Resources) or RegEx pattern (Patterns). |
MembershipsType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing membership permissions keyed by exact id (Resources) or RegEx pattern (Patterns). |
PNTokenCategories contains the following properties:
| Parameter | Description |
|---|---|
ChannelsType: PNTokenCategoryPermissionsDefault: Get is false | Permission to list all channel metadata. |
UuidsType: PNTokenCategoryPermissionsDefault: Get is false | Permission to list all UUID metadata. |
PNTokenCategoryPermissions has one bool property, Get. It is the only permission a category accepts. The SDK sends the get permission (32) for each category with Get set to true.
PNTokenAuthValues contains the following properties:
| Property Name | Type | Description |
|---|---|---|
Read | bool | Read permission. Applies to Subscribe, History, and Presence. |
Write | bool | Write permission. Applies to Publish. |
Manage | bool | Manage permission. Applies to Channel Groups and App Context. |
Create | bool | Create permission. Applies to DataSync. |
Delete | bool | Delete permission. Applies to History, App Context, and DataSync. |
Get | bool | Get permission. Applies to App Context and DataSync. |
Update | bool | Update permission. Applies to App Context and DataSync. |
Join | bool | Join permission. Applies to App Context. |
For DataSync resources, only Create, Get, Update, and Delete are meaningful. Set only those four properties and leave Read, Write, Manage, and Join false (the default), the backend doesn't interpret them for DataSync resources.
PNDataSyncProjections contains the following properties:
| Parameter | Description |
|---|---|
ResourcesType: PNDataSyncProjectionScopeDefault: n/a | Projection assignments for exact resource ids. |
PatternsType: PNDataSyncProjectionScopeDefault: n/a | Projection assignments keyed by RegEx pattern. |
PNDataSyncProjectionScope contains the following properties:
| Parameter | Description |
|---|---|
EntitiesType: Dictionary<string, string>Default: n/a | id (or RegEx pattern) to projection name. |
UsersType: Dictionary<string, string>Default: n/a | id (or RegEx pattern) to projection name. |
ChannelsType: Dictionary<string, string>Default: n/a | id (or RegEx pattern) to projection name. |
RelationshipsType: Dictionary<string, string>Default: n/a | id (or RegEx pattern) to projection name. |
MembershipsType: Dictionary<string, string>Default: n/a | id (or RegEx pattern) to projection name. |
Projections control which payload fields a token can read and write on a DataSync resource. Each id (or pattern) maps to one projection name, __default__ is the platform's built-in base projection, and exact id assignments (Resources) take priority over pattern matches (Patterns). A resource that matches neither falls back to __default__. The SDK passes any projection name through as an opaque string, __default__ isn't validated or defaulted client-side, it's a platform convention rather than an SDK-enforced value. A grant request that sets only DataSyncProjections, without any Resources or Patterns permissions, is still valid. Refer to the DataSync projections guide for how a token selects a projection.
A projection is declared per property on the class definition, so the names you can assign here are the ones the entity class or relationship class declares. A class allows at most 3 distinct projection names in total, and __default__ counts toward that 3 as soon as any property uses it, which leaves 2 custom names in practice.
note
PNDataSyncProjectionScope covers all five resource kindsThe platform accepts projection assignments for five DataSync resource kinds: entities, users, channels, relationships, and memberships. PNDataSyncProjectionScope exposes Entities, Users, Channels, Relationships, and Memberships, so you can assign a projection to a DataSync user or channel object the same way you would to an entity. Permission (not projection) for those same user and channel objects still comes from the top-level Users and Channels scopes. Uuids applies only to App Context metadata. DataSyncProjections only decides which fields of the object a token can read and write.
Projections also scope real-time event payloads, and each named projection publishes its view to a separate __<projection>__<id> channel. A token's projection assignment does not automatically select or authorize that event channel, so control who receives restricted fields with Channels grants on the projection channels. Refer to Projection channels.
Required key/value mappings
For a successful grant request, you must specify permissions for at least one UUID, channel, group, or DataSync resource, or a DataSyncProjections assignment, either as a resource list (Resources) or as a pattern (RegEx, Patterns). A Categories grant alone also satisfies this requirement.
Sample code
Reference code
1
Returns
The GrantToken() operation returns PNResult<PNAccessManagerTokenResult> which contains the following properties:
| Property | Description |
|---|---|
ResultType: PNAccessManagerTokenResult | Returns a PNAccessManagerTokenResult object. |
StatusType: PNStatus | Returns a PNStatus object. |
PNAccessManagerTokenResult contains the following properties:
| Parameter | Description |
|---|---|
Token *Type: String | Current token with embedded permissions. |
1{ "Token":"p0thisAkFl043rhDdHRsCkNyZXisRGNoYW6hanNlY3JldAFDZ3Jwsample3KgQ3NwY6BDcGF0pERjaGFuoENnctokenVzcqBDc3BjoERtZXRhoENzaWdYIGOAeTyWGJI"}
Other examples
Grant an authorized client different levels of access to various resources in a single call
The code below grants my-authorized-uuid:
- Read access to
channel-a,channel-group-b, and get touuid-c. - Read/write access to
channel-b,channel-c,channel-d, and get/update touuid-d.
1
Grant an authorized client read access to multiple channels using RegEx
The code below grants my-authorized-uuid read access to all channels that match the channel-[A-Za-z0-9] RegEx pattern.
1
Grant an authorized client different levels of access to various resources and read access to channels using RegEx in a single call
The code below grants the my-authorized-uuid:
- Read access to
channel-a,channel-group-b, and get touuid-c. - Read/write access to
channel-b,channel-c,channel-d, and get/update touuid-d. - Read access to all channels that match the
channel-[A-Za-z0-9]RegEx pattern.
1
Grant an authorized client access to list all channel and uuid metadata
The code below grants my-authorized-uuid the get category permission for both channels and uuids, so the client can list all channel and uuid metadata on the subscribe key.
1
Grant an authorized client access to DataSync resources
The code below grants user-alice get access to the entity product-sneaker-42 and get access to all entities that match the product-.* RegEx pattern. DataSync users such as user-bob are not permissioned under DataSync, grant them through the top-level Users scope instead.
1
Grant a token with a field-level projection
The code below grants user-alice the same access as above and assigns the public projection to the entity product-sneaker-42. With this projection, Alice reads and writes only the fields that the public projection exposes on that entity.
1
Error responses
If you submit an invalid request, the server returns HTTP 400 with a message that identifies the missing or incorrect argument. Causes can include a RegEx issue, an invalid timestamp, or incorrect permissions.
Revoke token
Requires Access Manager add-on
This method requires that the Access Manager add-on is enabled for your key in the Admin Portal. See Enable the features your app calls.
Enable token revoke
To revoke tokens, you must first enable this feature on the Admin Portal. To do that, navigate to your app's keyset and mark the Revoke v3 Token checkbox in the ACCESS MANAGER section.
The RevokeToken() method allows you to disable an existing token and revoke all permissions embedded within. You can only revoke a valid token previously obtained using the GrantToken() method.
Use this method for tokens with TTL less than or equal to 30 days. If you need to revoke a token with a longer TTL, contact support.
For more information, refer to Revoke permissions.
Method(s)
1pubnub.RevokeToken()
2 .Token(string)
3 .QueryParam(Dictionary<string, object>)
4 .Execute(System.Action<PNAccessManagerRevokeTokenResult, PNStatus>)
| Parameter | Description |
|---|---|
Token *Type: stringDefault: n/a | Existing token with embedded permissions. |
QueryParamType: Dictionary <string, object>Default: n/a | Dictionary object to pass name/value pairs as query string params with PubNub URL request for debug purposes. |
ExecuteType: System.ActionDefault: n/a | System.Action of type PNAccessManagerRevokeTokenResult. |
ExecuteAsyncType: None Default: n/a | Returns Task<PNResult<PNAccessManagerRevokeTokenResult>>. |
Sample code
1
Returns
The RevokeToken() operation returns PNResult<PNAccessManagerRevokeTokenResult> which contains the following properties:
| Property | Description |
|---|---|
ResultType: PNAccessManagerRevokeTokenResult | Returns an empty PNAccessManagerRevokeTokenResult object when the token revocation request is successful. |
StatusType: PNStatus | Returns a PNStatus object for operations ending in success or failure. |
Error Responses
If you submit an invalid request, the server returns an error status code with a descriptive message informing which of the provided arguments is missing or incorrect. Depending on the root cause, this operation may return the following errors:
400 Bad Request403 Forbidden503 Service Unavailable
Parse token
The ParseToken() method decodes an existing token and returns the object containing permissions embedded in that token. The client can use this method for debugging to check the permissions to the resources or find out the token's TTL details. The returned PNTokenContent also reports whether the token allows listing all channel or UUID metadata, through its Categories property.
If the token was granted with DataSync resource permissions, DataSync projections, or both, ParseToken() also decodes those into the returned object. Resources.DataSync and Patterns.DataSync (both of type PNDataSyncTokenScopes) expose the decoded entity, relationship, and membership permissions, and a Projections property (type PNDataSyncProjections) exposes the decoded projection assignments. The DataSync, Users, and Meta keys appear only when the token actually granted them, so guard the access when you read one.
Method(s)
1ParseToken(String token)
| Parameter | Description |
|---|---|
token *Type: String | Current token with embedded permissions. |
Sample code
1
Returns
1
When the parsed token carries DataSync permissions or projections, the returned PNTokenContent also includes them. Resources.DataSync and Patterns.DataSync hold the same Entities, Relationships, and Memberships dictionaries described under Grant token, and Projections holds the same Resources/Patterns projection scopes accepted by .DataSyncProjections(). For example, a token granted with the product-sneaker-42 entity permission and the public projection from that entity parses to a Resources.DataSync.Entities entry for product-sneaker-42 and a Projections.Resources.Entities entry mapping product-sneaker-42 to "public".
To better understand the structure of the TokenContents object, see the details of all related custom types:
TokenContents
| Parameter | Description |
|---|---|
ResourcesType: TokenResources | Resource permissions specified in a sequence. |
PatternsType: TokenPatterns | Resource permissions expressed as RegEx patterns. |
CategoriesType: PNTokenCategories | Category-level permissions to list all channel or UUID metadata. Always set. |
MetaType: Dictionary<string, object> | Extra metadata to be published with the request. Values must be scalar only; arrays or objects aren't supported. |
SignatureType: string | HMAC+SHA256 signed with a PubNub confidential signing key. |
VersionType: int | Version of the token structure. |
TimestampType: long | Parameter generated on the server side to record the time when the token was created. |
TTLType: int | Total number of minutes for which the token is valid.
|
AuthorizedUUIDType: string | Single UUID which is solely authorized to use the token to make API requests to PubNub. |
TokenResources
| Parameter | Description |
|---|---|
ChannelsType: Dictionary<string, TokenAuthValues> | Individual or sequential channel permissions. |
GroupsType: Dictionary<string, TokenAuthValues> | Individual or sequential group permissions. |
UUIDsType: Dictionary<string, TokenAuthValues> | Individual or sequential UUID permissions. This resource is only used in Objects v2 operations. |
TokenPatterns
| Parameter | Description |
|---|---|
ChannelsType: Dictionary<string, TokenAuthValues> | Channel permissions expressed as RegEx patterns. |
GroupsType: Dictionary<string, TokenAuthValues> | Group permissions expressed as RegEx patterns. |
UUIDsType: Dictionary<string, TokenAuthValues> | UUID permissions expressed as RegEx patterns. This resource is only used in Objects v2 operations. |
-
TokenAuthValuesRead(bool)Write(bool)Manage(bool)Delete(bool)Get(bool)Update(bool)Join(bool)
Category permissions
Categories on the returned PNTokenContent is always set. Categories.Channels.Get is true only when the token can list all channel metadata, and Categories.Uuids.Get is true only when it can list all UUID metadata. A category the token doesn't carry is false, not null. Named resource permissions in Resources and Patterns don't change these values.
The code below parses a token and reads its category permissions.
1
Error Responses
If you receive an error while parsing the token, it may suggest that the token is damaged. In that case, request the server to issue a new one.
Set token
The SetAuthToken() method is used by the client devices to update the authentication token granted by the server.
Method(s)
1SetAuthToken(String token)
| Parameter | Description |
|---|---|
token *Type: String | Current token with embedded permissions. |
Sample code
1
Returns
This method doesn't return any response value.
Grant token - spaces & users (deprecated)
Requires Access Manager add-on
This method requires that the Access Manager add-on is enabled for your key in the Admin Portal. See Enable the features your app calls.
The GrantToken() method generates a time-limited authorization token with an embedded access control list. The token defines time to live (TTL), AuthorizedUserId, and a set of permissions giving access to one or more resources:
SpacesUsers(other users' metadata, such as their names or avatars)
Only this AuthorizedUserId will be able to use the token with the defined permissions. The authorized client will send the token to PubNub with each request until the token's TTL expires. Any unauthorized request or a request made with an invalid token will return a 403 with a respective error message.
Permissions - spaces & users (deprecated)
The grant request allows your server to securely grant your clients access to the resources within the PubNub Platform. There is a limited set of operations the clients can perform on every resource:
| Resource | Permissions |
|---|---|
Spaces | read, write, get, manage, update, join, delete |
Users | get, update, delete |
For permissions and API operations mapping, refer to Manage Permissions with Access Manager v3.
TTL - spaces & users (deprecated)
The TTL (time to live) parameter is the number of minutes before the granted permissions expire. The client will require a new token to be granted before expiration to ensure continued access. ttl is a required parameter for every grant call and there is no default value set for it. The max value for ttl is 43,200 (30 days).
For more details, see TTL in Access Manager v3.
RegEx - spaces & users (deprecated)
If you prefer to specify permissions by setting patterns, rather than listing all resources one by one, you can use regular expressions. To do this, set RegEx permissions as Patterns before making a grant request.
For more details, see RegEx in Access Manager v3.
Authorized user ID - spaces & users (deprecated)
Setting an AuthorizedUserId in the token helps you specify which client device should use this token in every request to PubNub. This will ensure that all requests to PubNub are authorized before PubNub processes them. If AuthorizedUserId isn't specified during the grant request, the token can be used by any client with any UserId. It's recommended to restrict tokens to a single AuthorizedUserId to prevent impersonation.
For more details, see Authorized UUID in Access Manager v3.
Method(s) - spaces & users (deprecated)
1pubnub.GrantToken()
2 .TTL(int)
3 .Meta(Dictionary<string, object>)
4 .AuthorizedUserId(string)
5 .Resources(PNTokenResources)
6 .Patterns(PNTokenPatterns)
7 .QueryParam(Dictionary<string,object>)
8 .Execute(System.Action<PNAccessManagerTokenResult, PNStatus>)
| Parameter | Description |
|---|---|
TTL *Type: intDefault: n/a | Total number of minutes for which the token is valid.
|
MetaType: Dictionary <string, object>Default: n/a | Extra metadata to be published with the request. Values must be scalar only; arrays or objects aren't supported. |
AuthorizedUserIdType: stringDefault: n/a | Single Uuid which is authorized to use the token to make API requests to PubNub. |
ResourcesType: PNTokenResourcesDefault: n/a | Object containing channel, channel group, and UUID metadata permissions. |
PatternsType: PNTokenPatternsDefault: n/a | Object containing permissions to apply to all channel, channel group, and UUID metadata matching the RegEx pattern. |
QueryParamType: Dictionary <string, object>Default: n/a | Dictionary object to pass name/value pairs as query string params with PubNub URL request for debug purposes. |
ExecuteType: PNCallbackDefault: n/a | System.Action of type PNAccessManagerTokenResult. |
ExecuteAsyncType: None Default: n/a | Returns Task<PNResult<PNAccessManagerTokenResult>>. |
PNTokenResources contains the following properties:
| Parameter | Description |
|---|---|
SpacesType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing Space permissions. |
UsersType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing User metadata permissions. |
PNTokenPatterns contains the following properties:
| Parameter | Description |
|---|---|
SpacesType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing permissions to apply to all Spaces matching the RegEx pattern. |
UsersType: Dictionary<string, PNTokenAuthValues>Default: n/a | Dictionary object containing permissions to apply to all User metadata matching the RegEx pattern. |
PNTokenAuthValues contains the following properties:
| Property Name | Type | Description |
|---|---|---|
Read | bool | Read permission. |
Write | bool | Write permission. |
Manage | bool | Manage permission. |
Delete | bool | Delete permission. |
Get | bool | Get permission. |
Update | bool | Update permission. |
Join | bool | Join permission. |
Required key/value mappings
For a successful grant request, you must specify permissions for at least one User or Space either as a resource list or as a pattern (RegEx).
Sample code - spaces & users (deprecated)
1
Returns - spaces & users (deprecated)
The GrantToken() operation returns PNResult<PNAccessManagerTokenResult> which contains the following properties:
| Property | Description |
|---|---|
ResultType: PNAccessManagerTokenResult | Returns a PNAccessManagerTokenResult object. |
StatusType: PNStatus | Returns a PNStatus object. |
PNAccessManagerTokenResult contains the following properties:
| Parameter | Description |
|---|---|
Token *Type: String | Current token with embedded permissions. |
1{ "Token":"p0thisAkFl043rhDdHRsCkNyZXisRGNoYW6hanNlY3JldAFDZ3Jwsample3KgQ3NwY6BDcGF0pERjaGFuoENnctokenVzcqBDc3BjoERtZXRhoENzaWdYIGOAeTyWGJI"}
Other examples - spaces & users (deprecated)
Grant an authorized client different levels of access to various resources in a single call - spaces & users (deprecated)
The code below grants my-authorized-userId:
- Read access to
space-a, and get touserId-c. - Read/write access to
space-b,space-c,space-d, and get/update touserId-d.
1
Grant an authorized client read access to multiple spaces using RegEx - spaces & users (deprecated)
The code below grants my-authorized-userId read access to all channels that match the space-[A-Za-z0-9] RegEx pattern.
1
Grant an authorized client different levels of access to various resources and read access to spaces using RegEx in a single call - spaces & users (deprecated)
The code below grants the my-authorized-userId:
- Read access to
space-aanduserId-c. - Read/write access to
space-b,space-c,space-d, and get/update touserId-d. - Read access to all channels that match the
space-[A-Za-z0-9]RegEx pattern.
1
Error Responses - spaces & users (deprecated)
If you submit an invalid request, the server returns the 400 error status code with a descriptive message informing which of the provided arguments is missing or incorrect. These can include, for example, issues with a RegEx, a timestamp, or permissions.