首页 > 解决方案 > DocuSign:对于 Angular 应用程序 - 为什么 OAuth 重定向 URL 不能包含片段指示符 (#)?

问题描述

我有一个前端应用程序,其 url 看起来像http://localhost:4200/#/dashboard-> 完成身份验证后,这也应该称为重定向 url。不幸的是,当应用程序重定向到 DocuSign 登录页面时,我注意到 # 之后的重定向 url 部分被切断了。它是一个错误吗?我怎么能省略它?

在 DocuSign 面板中,我将重定向 url 设置为:http://localhost:4200/#/dashboard 重定向到 DocuSign 以登录的我的 url 看起来像: https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature&client_id={integrator_key}&redirect_uri=http://localhost:4200/#/dashboard DocuSign 构造的 url(包括重定向 url)看起来像: https://account-d.docusign.com/oauth/auth?response_type=code&scope=signature&client_id={integrator_key}&redirect_uri=http://localhost:4200/piggyagent#/username没有东西之后#结束The provided customer ID is not registered in the DocuSign service.

标签: angularredirecthashdocusignapi

解决方案


根据您可以在此处找到的 oauth v2 规范,这是不允许的 - https://www.oauth.com/oauth2-servers/redirect-uris/redirect-uri-registration/表示“注册的重定向 URL 可能包含查询字符串参数, 但不能在片段中包含任何内容。如果开发人员尝试注册包含片段的重定向 URL,则注册服务器应拒绝该请求。”

您可以使用状态来传递信息并在代码的另一端再次重定向。


推荐阅读