VKAccessToken Class Reference

Inherits from VKObject : NSObject
Conforms to NSCoding
Declared in VKAccessToken.h
VKAccessToken.m

Overview

Presents VK API access token that used for loading API methods and other stuff.

Other Methods

  accessToken

String token for use in request parameters

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

Discussion

String token for use in request parameters

Declared In

VKAccessToken.h

  userId

Current user id for this token

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

Discussion

Current user id for this token

Declared In

VKAccessToken.h

  secret

User secret to sign requests (if nohttps used)

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

Discussion

User secret to sign requests (if nohttps used)

Declared In

VKAccessToken.h

  expiresIn

Time when token expires

@property (nonatomic, readonly, assign) NSInteger expiresIn

Discussion

Time when token expires

Declared In

VKAccessToken.h

  httpsRequired

If user sets “Always use HTTPS” setting in his profile, it will be true

@property (nonatomic, readonly, assign) BOOL httpsRequired

Discussion

If user sets “Always use HTTPS” setting in his profile, it will be true

Declared In

VKAccessToken.h

  created

Indicates time of token creation

@property (nonatomic, readonly, assign) NSTimeInterval created

Discussion

Indicates time of token creation

Declared In

VKAccessToken.h

  localUser

Indicates time of token creation

@property (nonatomic, readonly, strong) VKUser *localUser

Discussion

Indicates time of token creation

Declared In

VKAccessToken.h

+ tokenFromUrlString:

Retrieve token from key-value query string

+ (instancetype)tokenFromUrlString:(NSString *)urlString

Parameters

urlString

string that contains URL-query part with token. E.g. access_token=ffffff&expires_in=0…

Return Value

parsed token

Discussion

Retrieve token from key-value query string

Declared In

VKAccessToken.h

+ tokenWithToken:secret:userId:

Create token with existing properties

+ (instancetype)tokenWithToken:(NSString *)accessToken secret:(NSString *)secret userId:(NSString *)userId

Parameters

accessToken

token string

secret

secret

userId

user id

Return Value

new token

Discussion

Create token with existing properties

Declared In

VKAccessToken.h

+ savedToken:

Retrieve token from user defaults. Token must be saved to defaults with saveTokenToDefaults method

+ (instancetype)savedToken:(NSString *)defaultsKey

Parameters

defaultsKey

path to file with saved token

Return Value

parsed token

Discussion

Retrieve token from user defaults. Token must be saved to defaults with saveTokenToDefaults method

Declared In

VKAccessToken.h

– saveTokenToDefaults:

Save token into user defaults by specified key

- (void)saveTokenToDefaults:(NSString *)defaultsKey

Parameters

defaultsKey

key for defaults

Discussion

Save token into user defaults by specified key

Declared In

VKAccessToken.h

– isExpired

Return YES if token has expired

- (BOOL)isExpired

Discussion

Return YES if token has expired

Declared In

VKAccessToken.h

+ delete:

Remove token from storage

+ (void)delete:(NSString *)service

Discussion

Remove token from storage

Declared In

VKAccessToken.h

Other Methods

+ getKeychainQuery:

Simple keychain requests Source: http://stackoverflow.com/a/5251820/1271424

+ (NSMutableDictionary *)getKeychainQuery:(NSString *)service

Discussion

Simple keychain requests Source: http://stackoverflow.com/a/5251820/1271424

Declared In

VKAccessToken.m