asp.net-core-mvc - 是否可以添加自定义接受页面以登录亚马逊
问题描述
我有一个 Google SmartHome 应用程序,其中 Google 需要 Google SmartHome 设备的“特殊”接受/免责声明页面。我们目前正在使用自定义 OAuth 2.0 服务器并拥有自己的登录页面。对于当前设置,附加登录页面不是问题。这类似于询问用户是否同意允许应用程序访问配置文件信息的标准登录亚马逊 (LWA) 页面。是否可以自定义该页面或向流程添加其他页面。对于一个额外的中间页面,我在想这样的事情:
- 使用指向显示免责声明网页的非 LWA 网站的 URL
- 显示我们的免责声明
- 以某种方式重定向回 LWA 以完成 OAuth 序列
下面的代码块当然不起作用。它意味着更多的伪代码。我不知何故需要使用 OAuth 参数执行新的 GET,然后以某种方式“让开”/重定向回最初的 SmartHome 请求。
[httpGet]
public ActionResult Index(string client_id, string redirect_uri, string state, string scope, string response_type)
{
ViewBag.Client_id = client_id;
ViewBag.Redirect_uri = redirect_uri;
ViewBag.State = state;
ViewBag.Scope = scope;
ViewBag.Response_type = response_type;
return View();
}
[httpPost]
public ActionResult Accept(string client_id, string redirect_uri, string state, string scope, string response_type)
{
//don't know how return the query string
return RedirectPermanentPreserveMethod("https://www.amazon.com/ap/oa");
}
...
解决方案
所以如果你只看一下redirectPermenent的文档就不是那么难了
public ActionResult Index(string client_id, string redirect_uri, string state, string scope, string response_type)
{
ViewBag.Client_id = client_id;
ViewBag.Redirect_uri = redirect_uri;
ViewBag.State = state;
ViewBag.Scope = scope;
ViewBag.Response_type = response_type;
return View(); //disclaimer
}
[httpPost]
public ActionResult Accept(string client_id, string redirect_uri, string state, string scope, string response_type)
{
string uri = "https://www.amazon.com/ap/oa?" + "client_id=" + Client_id + "&redirect_uri=" + Redirect_uri + "&state=" + State + "&scope=" + Scope + "&response_type=" + Response_type;
return RedirectPermanentPreserveMethod(uri);
}
'''
推荐阅读
- docker - Docker容器无法挂载文件夹
- python - 如何在多个java文件中搜索某个语句?
- javascript - 如何修复此正则表达式以使其正确替换 *(在单词之间)?
- html - 我该怎么做才能使我的代码在 2 个不同的屏幕上看起来不错
- docker - 如何在 Jenkins 脚本化管道中使用 dockerhub-notification-plugin?
- php - 有没有办法在 MySQL 更新查询中使用变量
- javascript - 如何从 JQuery AJAX 生成的 HTML 数据中获取属性 id?JavaScript
- node.js - 如何通过 REST API 从 IONIC typescript 读取 node.js app.js 中的数据?
- go - 调用结构上的方法时,Goroutines 不起作用
- makefile - 由于安装 ROS 时 CPU 使用率达到 100,Raspberry Pi 冻结