Google apps script SSO重定向后,在应用程序脚本中路由到重定向url
我可以通过应用程序脚本在谷歌表单上路由到SSO urlGoogle apps script SSO重定向后,在应用程序脚本中路由到重定向url,google-apps-script,google-sheets,routing,single-sign-on,Google Apps Script,Google Sheets,Routing,Single Sign On,我可以通过应用程序脚本在谷歌表单上路由到SSO url function start(){ var authorize_url = 'https://login.eveonline.com/oauth/authorize/'; var response_type = '?response_type=code'; var redirect_uri = '&redirect_uri=http://localhost:4200/'; var client_id_val = '
function start(){
var authorize_url = 'https://login.eveonline.com/oauth/authorize/';
var response_type = '?response_type=code';
var redirect_uri = '&redirect_uri=http://localhost:4200/';
var client_id_val = 'id_string';
var client_id = '&client_id='+client_id_val;
var client_secret = 'secret_string';
var scope = '&scope=esi-assets.read_assets.v1';
var client_64 = 'clientString';
var authHeader = 'Basic '+client_64;
var tokenPOSTUrl = 'https://login.eveonline.com/oauth/token';
var SSOUrl = authorize_url
+response_type
+redirect_uri
+client_id
+scope;
var options = {
"followRedirects" : true
};
var result = UrlFetchApp.getRequest("http://localhost:4200/auth", options);
ConnectInventory(SSOUrl);
}
function ConnectInventory(authUrl){
var ui = SpreadsheetApp.getUi();
var result = ui.alert(
'SSO for inventory upload',
ui.ButtonSet.OK);
if(result == ui.Button.OK){
SSOTab(authUrl);
};
}
function SSOTab(SSOUrl){
var html = "<script>window.open('"+SSOUrl+"');google.script.host.close();</script>";
var userInterface = HtmlService.createHtmlOutput(html);
}
函数开始(){
var authorize\u url='1https://login.eveonline.com/oauth/authorize/';
变量响应类型='?响应类型=代码';
var redirect_uri='&redirect_uri=http://localhost:4200/';
var client_id_val='id_string';
var client_id='&client_id='+client_id_val;
var client_secret='secret_string';
var scope='&scope=esi assets.read_assets.v1';
var client_64='clientString';
var authHeader='Basic'+client_64;
变量tokenpostrl=https://login.eveonline.com/oauth/token';
var SSOUrl=授权\u url
+响应类型
+重定向\u uri
+客户识别码
+范围;
变量选项={
“followRedirects”:true
};
var result=UrlFetchApp.getRequest(“http://localhost:4200/auth“,选项);
连接库(SSOUrl);
}
函数连接库(authUrl){
var ui=SpreadsheetApp.getUi();
var result=ui.alert(
“用于资源清册上载的SSO”,
ui.ButtonSet.OK);
if(结果==ui.Button.OK){
SSOTab(authUrl);
};
}
函数SSOTab(SSOUrl){
var html=“window.open”(“+SSOUrl+”);google.script.host.close();”;
var userInterface=HtmlService.createHtmlOutput(html);
}
通过SSO成功登录后,SSO服务器将尝试路由到一个返回地址。在应用程序中,这被路由到一个组件,该组件对结果进行处理
但是,当SSO成功完成时,我将一无所获。使用Google Sheets和Apps脚本,有什么方法可以完成返回路由吗?您能否详细说明或共享一些示例代码/URL?如何调用SSO URL?什么是数据流?我认为您想要做的是可能的,但我正在尝试更好地理解端到端流程。在问题中添加了脚本。重定向uri应该是脚本发布的url
/exec
或/usercallback
。阅读并练习是的,是的!这就是我要找的。我不知道如何在不将整个过程部署为应用程序的情况下为重定向创建回调。我来看看这个。