3
只是想玩谷歌应用程序脚本。在匿名模式下,事情看起来很好。除此之外,任何人都可以打电话给我的剧本只是这样的片断所示:Google App脚本卷曲授权
curl "https://script.google.com/macros/s/.../exec?ip=\"$myIp\""
我用this manual就如何通过认证的GoogleLogin提示。问题是我发送授权令牌时收到的“401未授权”,并在谷歌方面设置了“我(所有者)/只有我自己”选项。 (令牌似乎本身是正确的,如果我省略了密码或输入错误,我就会收到“Bad auth”)如果我再次设置“任何人,甚至是匿名”,它都可以工作,但auth的东西好像被忽略了。什么是正确的方法来做到这一点?
#!/bin/bash
gmail=$1
password=$2
myIp=$3
GoogleAuthToken=""
GoogleAuthToken=`curl --silent https://www.google.com/accounts/ClientLogin --data-urlencode Email=$gmail \
--data-urlencode Passwd=$password -d accountType=GOOGLE -d source=YouDontSay -d service=lh2`
echo $GoogleAuthToken
GoogleAuthToken=$(echo "$GoogleAuthToken" | grep 'Auth=' | sed s/Auth=//)
echo $GoogleAuthToken
curl -L --silent --header "Authorization: GoogleLogin auth=$GoogleAuthToken" "https://script.google.com/macros/s/.../exec?ip=\"$myIp\""