WindVane miniapps support user information authorization. You can implement the authorization logic using the SDK. For the business workflow, see the miniapp open capability authorization in OpenAPI authorization mechanism. To access more features, associate the user with the container by following the steps in User association.
User information authorization
The WindVane miniapp container provides an interface for user information authorization. Implement the authorization logic in your superapp as follows.
-
Register
IMiniAppUserAuthServicewithServiceManager. -
In your
IMiniAppUserAuthServiceimplementation, implement the authorization business logic and UI interaction in thegetAuthCodemethod. You can design the authorization dialog box to match your app's visual style. -
In the
getAuthCodemethod, useIUserAuthCallbackto return the authorization result to the miniapp container. The container then passes the result to the miniapp.
Sample code:
ServiceManager.getInstance().registerService(IMiniAppUserAuthService.class.getName(), new IMiniAppUserAuthService() {
@Override
public void getAuthCode(Context context, String appId, List<String> scopes, IUserAuthCallback callback) {
// Implement your app's user authorization logic here.
}
});
For a list of predefined scopes, see Authorization introduction. You can also add custom scopes.