All Products
Search
Document Center

SuperApp:EMASMiniappUserAuthService (for WindVane)

Last Updated:Oct 25, 2024

The interface class provided by the miniapp container to request authorization from users. This API is applicable only to WindVane miniapps.

@protocol EMASMiniappUserAuthService <NSObject>

getAuthCode

- (void)getAuthCode:(NSString *)appId scopes:(NSArray *)scopes  successBlock:(EMASMiniappUserAuthSuccessBlock)successBlock failureBlock:(EMASMiniappUserAuthFailureBlock)failureBlock;

Obtains an authorization code to access user information.

Parameters

appId

NSString: the ID of the miniapp that requests authorization from the user.

scopes

NSArray: the list of requested scopes.

successBlock

EMASMiniappUserAuthSuccessBlock: the success callback block.

failureBlock

EMASMiniappUserAuthFailureBlock: the failure callback block.

EMASMiniappUserAuthSuccessBlock

typedef void(^EMASMiniappUserAuthSuccessBlock)(NSString *authCode, NSArray * userAuthSuccessScopes, NSDictionary *userAuthErrorScopes);

The callback function that is invoked when requested permissions are granted.

Parameters

authCode

NSString: the authorization code.

authSuccessScopes

NSArray: the scopes of permissions that are granted.

userAuthErrorScopes

NSDictionary: the scopes of permissions that fail to be granted. In a key-value pair, the key is the scope of authorization and the value is the error code.

EMASMiniappUserAuthFailureBlock

typedef void(^EMASMiniappUserAuthFailureBlock)(NSDictionary *userAuthErrorScopes);

The callback function that is invoked when requested permissions are not granted.

Parameters

userAuthErrorScopes

NSDictionary: the scopes of permissions that fail to be granted. In a key-value pair, the key is the scope of authorization and the value is the error code.