Inherits from NSObject
Conforms to NSSecureCoding
Declared in SPTSession.h

Overview

For persisting the session, you may use NSKeyedArchiver to obtain an NSData instance, which can be stored securely using Keychain Services.

Note: A session is valid for a certain period of time, and may be renewed without user intervention using SPTAuth.

Properties

accessToken

The access token of the authenticated user.

@property (nonatomic, copy, readonly) NSString *accessToken

Declared In

SPTSession.h

canonicalUsername

The canonical username of the authenticated user.

@property (nonatomic, copy, readonly) NSString *canonicalUsername

Declared In

SPTSession.h

encryptedRefreshToken

The encrypted refresh token.

@property (nonatomic, copy, readonly) NSString *encryptedRefreshToken

Declared In

SPTSession.h

expirationDate

The expiration date of the access token.

@property (nonatomic, copy, readonly) NSDate *expirationDate

Declared In

SPTSession.h

tokenType

The access token type.

@property (nonatomic, copy, readonly) NSString *tokenType

Declared In

SPTSession.h

Instance Methods

initWithUserName:accessToken:encryptedRefreshToken:expirationDate:

The deignated initializer for SPTSession.

- (instancetype)initWithUserName:(NSString *)userName accessToken:(NSString *)accessToken encryptedRefreshToken:(NSString *)encryptedRefreshToken expirationDate:(NSDate *)expirationDate

Parameters

userName

The username of the user.

accessToken

The access token of the user.

encryptedRefreshToken

The encrypted refresh token of the user.

expirationDate

The expiration date of the access token.

Return Value

An initialized SPTSession object.

Declared In

SPTSession.h

initWithUserName:accessToken:expirationDate:

The deignated initializer for SPTSession.

- (instancetype)initWithUserName:(NSString *)userName accessToken:(NSString *)accessToken expirationDate:(NSDate *)expirationDate

Parameters

userName

The username of the user.

accessToken

The access token of the user.

expirationDate

The expiration date of the access token.

Return Value

An initialized SPTSession object.

Declared In

SPTSession.h

initWithUserName:accessToken:expirationTimeInterval:

Initializer that takes an NSTimeInterval until the access token expires, instead of an NSDate.

- (instancetype)initWithUserName:(NSString *)userName accessToken:(NSString *)accessToken expirationTimeInterval:(NSTimeInterval)timeInterval

Parameters

userName

The username of the user.

accessToken

The access token of the user.

timeInterval

The time interval until the access token expires.

Return Value

An initialized SPTSession object.

Declared In

SPTSession.h

isValid

Returns whether the session is still valid.

- (BOOL)isValid

Return Value

YES if valid, otherwise NO.

Discussion

Determining validity is done by comparing the current date and time with the expiration date of the SPTSession object.

Declared In

SPTSession.h