Support per-app WeChat MP credentials on outbound reply#1530
Open
bingran-you wants to merge 2 commits intodevfrom
Open
Support per-app WeChat MP credentials on outbound reply#1530bingran-you wants to merge 2 commits intodevfrom
bingran-you wants to merge 2 commits intodevfrom
Conversation
WeChat MP openids are scoped to the receiving Official Account's app_id, so a reply can only be delivered using credentials for the same app_id that received the inbound message. The previous outbound path always loaded the single-app WECHAT_MP_APP_ID/_APP_SECRET pair, which caused "invalid openid" failures whenever the gateway received messages for a different app_id than the one configured (issue #1527). - Add WeChatMpOutboundAdapter::from_env_with_app_id which reads a new optional WECHAT_MP_APPS_JSON array of {app_id, app_secret} entries and falls back to the existing single-app env vars when no match or when no app_id is requested. - Plumb normalized_channel_metadata().wechat_mp_app_id from SendReplyTask through execute_wechat_mp_send so the correct credentials are selected per reply. - Update the quick-response path in inbound/quick_responses.rs to pass the inbound message's wechat_mp_app_id through to the adapter. Refs #1527
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WeChatMpOutboundAdapter::from_env_with_app_idwhich supports both per-app credentials via a newWECHAT_MP_APPS_JSONenv (JSON array of{app_id, app_secret}) and the existing single-appWECHAT_MP_APP_ID/WECHAT_MP_APP_SECRETas a fallback.normalized_channel_metadata().wechat_mp_app_idfromSendReplyTaskthroughexecute_wechat_mp_sendso outbound replies use credentials for the app the inbound message arrived on.app_idthrough the quick-response path inservice/inbound/quick_responses.rs.Why
WeChat MP openids are scoped to the Official Account's
app_id. Previously,execute_wechat_mp_sendalways calledWeChatMpOutboundAdapter::from_env()which reads a single app's credentials, so replies for any otherapp_idseen by the gateway failed withinvalid openiderrors (issue #1527).Rollout
WECHAT_MP_APPS_JSON=[{\"app_id\":\"gh_...\",\"app_secret\":\"...\"}, ...]. Entries override the single-app default when theapp_idmatches.Test plan
cargo check -p scheduler_module(clean, no new warnings)app_idRefs #1527