ARTTokenDetails
Objective-C
@interface ARTTokenDetails : NSObject <NSCopying>
Swift
class ARTTokenDetails : NSObject, NSCopying
Contains an Ably Token and its associated metadata.
-
The Ably Token itself. A typical Ably Token string appears with the form
xVLyHw.A-pwh7wicf3afTfgiw4k2Ku33kcnSA7z6y8FjuYpe3QaNRTEo4.Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull token;Swift
var token: String { get } -
The timestamp at which this token expires as a
NSDateobject.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSDate *expires;Swift
var expires: Date? { get } -
The timestamp at which this token was issued as a
NSDateobject.Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSDate *issued;Swift
var issued: Date? { get } -
The capabilities associated with this Ably Token. The capabilities value is a JSON-encoded representation of the resource paths and associated operations. Read more about capabilities in the capabilities docs.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *capability;Swift
var capability: String? { get } -
The client ID, if any, bound to this Ably Token. If a client ID is included, then the Ably Token authenticates its bearer as that client ID, and the Ably Token may only be used to perform operations on behalf of that client ID. The client is then considered to be an identified client.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *clientId;Swift
var clientId: String? { get } -
A static factory method to create an
ARTTokenDetailsobject from a deserializedTokenDetails-like object or a JSON stringifiedTokenDetailsobject. This method is provided to minimize bugs as a result of differing types by platform for fields such astimestamporttl. For example, in Rubyttlin theTokenDetailsobject is exposed in seconds as that is idiomatic for the language, yet when serialized to JSON usingto_jsonit is automatically converted to the Ably standard which is milliseconds. By using thefromJsonmethod when constructing anTokenDetailsobject, Ably ensures that all fields are consistently serialized and deserialized across platforms.Declaration
Objective-C
+ (ARTTokenDetails *_Nullable)fromJson:(nonnull id<ARTJsonCompatible>)json error:(NSError *_Nullable *_Nullable)errorPtr;Swift
class func fromJson(_ json: any ARTJsonCompatible) throws -> ARTTokenDetailsParameters
jsonA deserialized
TokenDetails-like object or a JSON stringifiedTokenDetailsobject.errorPtrA reference to the
NSErrorobject where an error information will be saved in case of failure.Return Value
An Ably authentication token.