JavaScript-WeChat JS-SDK using permission Signature Algorithm questions

Source: Internet
Author: User
Keywords Javascript php WeChat js-sdk micro-letter
The string to be signed is:

jsapi_ticket=sM4AOVdWfPE4DxkXGEs8VMCPGGVi4C3VM0P37wVUCFvkVAy_90u5h9nbSlYy3-Sl-HhTdfl2fzFy1AOcHKP7qg&noncestr=Wm3WZYTPz0wzccnW&timestamp=1414587457&url=http://mp.weixin.qq.com?params=value

Where the contents of the URL are more "/", such as:
url=http://mp.weixin.qq.com?params=value(无“/”)
url=http://mp.weixin.qq.com/?params=value(有“/”)
Will cause "Invalid URL domain" error, why?

Reply content:

The string to be signed is:

jsapi_ticket=sM4AOVdWfPE4DxkXGEs8VMCPGGVi4C3VM0P37wVUCFvkVAy_90u5h9nbSlYy3-Sl-HhTdfl2fzFy1AOcHKP7qg&noncestr=Wm3WZYTPz0wzccnW&timestamp=1414587457&url=http://mp.weixin.qq.com?params=value

Where the contents of the URL are more "/", such as:
url=http://mp.weixin.qq.com?params=value(无“/”)
url=http://mp.weixin.qq.com/?params=value(有“/”)
Will cause "Invalid URL domain" error, why?

Has anyone encountered this problem?

'/' will cause you to pass the URL of the parameter is incomplete, the SDK received the URL and your actual URL does not match, of course, will invalid domain.

This and your front-end to submit the URL to the interface of the method has a relationship, simply said that the URL encode a bit can be avoided. Some libraries such as jquery or zepto may have encode this step in the Ajax package, if you write a native Ajax, you may miss the encode, resulting in incomplete parameter delivery.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.