MLWeChatAccessToken Class Reference

Inherits from NSObject
Declared in MLWeChatAccessToken.h

Overview

@class MLWeChatAccessToken

  userID

Returns the wechat user ID.

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

Declared In

MLWeChatAccessToken.h

  tokenString

Returns the wechat access token.

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

Declared In

MLWeChatAccessToken.h

  expirationDate

Returns the expiration date.

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

Declared In

MLWeChatAccessToken.h

  refreshToken

Returns the refresh token.

@property (readonly, nonatomic, copy, nullable) NSString *refreshToken

Declared In

MLWeChatAccessToken.h

  scope

Returns the scope.

@property (readonly, nonatomic, copy, nullable) NSString *scope

Declared In

MLWeChatAccessToken.h

– initWithTokenString:userID:expirationDate:refreshToken:scope:

Initializes a new instance.

- (instancetype)initWithTokenString:(NSString *)tokenString userID:(NSString *)userID expirationDate:(nullable NSDate *)expirationDate refreshToken:(nullable NSString *)refreshToken scope:(nullable NSString *)scope

Parameters

tokenString

The opaque token string.

userID

The wechat user id

expirationDate

The optional expiration date (defaults to distantFuture).

refreshToken

The refresh token

scope

The API scopes requested by the app in a list of comma-delimited, case sensitive strings.

Return Value

An instance of MLWeChatAccessToken.

Declared In

MLWeChatAccessToken.h

+ currentAccessToken

Returns the “global” wechat access token that represents the currently logged in user.

+ (nullable MLWeChatAccessToken *)currentAccessToken

Declared In

MLWeChatAccessToken.h

+ refreshCurrentAccessToken:

Renew current wechat access token using refresh.

+ (void)refreshCurrentAccessToken:(nullable MLBooleanResultBlock)completionHandler

Parameters

completionHandler

An optional callback handler that can surface any errors related to access token refreshing.

Discussion

On a successful refresh, the currentAccessToken will be updated so you typically only need to observe the MLWeChatAccessTokenDidChangeNotification notification.

Declared In

MLWeChatAccessToken.h