我有一个Google SmartHome应用,其中Google要求Google SmartHome设备具有“特殊”接受/免责声明页面。我们当前使用的是自定义OAuth 2.0服务器,并且拥有自己的登录页面。对于当前设置,其他登录页面不是问题。这类似于标准登录亚马逊(LWA)页面,该页面询问用户是否同意允许该应用访问配置文件信息。是否可以自定义该页面或向该过程添加其他页面。对于其他干预页面,我在想类似的东西:
下面的代码块当然不起作用。它意味着更多的伪代码。我以某种方式需要使用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");
}
...
答案 0 :(得分:0)
如果您只看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);
}
'''