UntrustedMemoryOAuth2Session
An OAuth2Session implementation the stores OAuth2 metadata in-memory
-
The account id.
Declaration
Swift
public var accountId: String
-
The access token which expires.
Declaration
Swift
public var accessToken: String?
-
The access token’s expiration date.
Declaration
Swift
public var accessTokenExpirationDate: NSDate?
-
The refresh tokens. This toke does not expire and should be used to renew access token when expired.
Declaration
Swift
public var refreshToken: String?
-
The refresh token’s expiration date.
Declaration
Swift
public var refreshTokenExpirationDate: NSDate?
-
Check validity of accessToken. return true if still valid, false when expired.
Declaration
Swift
public func tokenIsNotExpired() -> Bool
-
Check validity of refreshToken. return true if still valid, false when expired.
Declaration
Swift
public func refreshTokenIsNotExpired() -> Bool
-
Save in memory tokens information. Saving tokens allow you to refresh accesstoken transparently for the user without prompting for grant access.
Declaration
Swift
public func saveAccessToken(accessToken: String?, refreshToken: String?, accessTokenExpiration: String?, refreshTokenExpiration: String?)
-
Clear all tokens. Method used when doing logout or revoke.
Declaration
Swift
public func clearTokens()
-
Initialize session using account id.
Declaration
Swift
public init(accountId: String, accessToken: String? = nil, accessTokenExpirationDate: NSDate? = nil, refreshToken: String? = nil, refreshTokenExpirationDate: NSDate? = nil)
Parameters
accountId
uniqueId to identify the oauth2module.
accessToken
optional parameter to initilaize the storage with initial values.
accessTokenExpirationDate
optional parameter to initilaize the storage with initial values.
refreshToken
optional parameter to initilaize the storage with initial values.
refreshTokenExpirationDate
optional parameter to initilaize the storage with initial values.