Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【小程序/公众号】提供了更新access_token的消费接口 #3005

Merged

Conversation

FreeOfYou
Copy link

如何使用:

  1. 多个 appid 配置类,需要继承 WxMaDefaultConfigImpl
  2. 设置 WxMaDefaultConfigImpl#setUpdateAccessTokenBefore 的消费者: 例子:
  public void init() {
    WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
//     //第一种方式
//    config.setUpdateAccessTokenBefore(e -> {
//      System.out.println("token:" + e.toString());
//    });
    //第二种方式
    config.setUpdateAccessTokenBefore(this::updateAccessTokenBefore);
  }

  private void updateAccessTokenBefore(WxAccessTokenEntity wxAccessTokenEntity) {
    System.out.println("token:" + wxAccessTokenEntity.toString());
  }
  1. 动态开启是否进行回调 WxMaDefaultConfigImpl#enableUpdateAccessTokenBefore,默认开启了回调

@binarywang
Copy link
Member

请解决下冲突,谢谢

@binarywang binarywang linked an issue May 8, 2023 that may be closed by this pull request
@binarywang binarywang merged commit 899ea65 into Wechat-Group:develop May 11, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

【小程序】建议提供获取access_token成功后相关回调
2 participants