在bash中使用curl将OAuth2.0转换为vk.com

在bash中使用curl将OAuth2.0转换为vk.com,bash,curl,oauth-2.0,vk,Bash,Curl,Oauth 2.0,Vk,我想写一个bash脚本,它将与vk.comapi一起工作 我的第一步是进行OAuth2.0授权。但我不能使用web浏览器,因为我的脚本将在没有xserver的机器上工作 如开发者页面所述,我首先需要提出GET请求: https://oauth.vk.com/authorize?client_id=<myapp_id>&redirect_uri=https://oauth.vk.com/blank.html&display=mobile&scope=video,

我想写一个bash脚本,它将与vk.comapi一起工作

我的第一步是进行OAuth2.0授权。但我不能使用web浏览器,因为我的脚本将在没有xserver的机器上工作

如开发者页面所述,我首先需要提出GET请求:

https://oauth.vk.com/authorize?client_id=<myapp_id>&redirect_uri=https://oauth.vk.com/blank.html&display=mobile&scope=video,audio&response_type=token&v=5.44&revoke=1
并作为参数传递到下一个输入:

_origin, ip_h, lg_h, to, email, pass
但它不起作用。我在使用curl时没有得到任何信息,在使用gui的不同rest客户机时会得到错误的传递或登录消息的错误页面。我认为问题可能出在饼干上,但添加饼干并没有什么效果

我正在努力使脚本代码生效:

#!/bin/bash
username=$1
password=$2

response=$(curl --cookie-jar vk.txt "https://oauth.vk.com/authorize" --data "client_id=<app_id>&redirect_uri=https://oauth.vk.com/blank.html&display=mobile&scope=video,audio&response_type=token&v=5.44&revoke=1")
echo "response is $response"
echo "================================================================="
response=$(curl --request POST --cookie vk.txt "https://login.vk.com/?act=login&soft=1&utf8=1" --data-urlencode "_origin=https://oauth.vk.com&ip_h=<some_value>&lg_h=<some_value>&to=<some_value>&email=<my_email>&pass=<my_pass>")
echo "response is $response"
echo "================================================================="

exit 0
#/bin/bash
用户名=$1
密码=$2

响应=$(curl--cookie jar vk.txt)https://oauth.vk.com/authorize“--data”client_id=

这里的问题到底是什么?在我第二次请求后,我应该获得具有权限的页面,但我没有获得此页面。我使用rest客户端获得错误页面,而使用curl没有获得任何内容(可能是空白页面)。问题是我做错了什么?
_origin, ip_h, lg_h, to, email, pass
#!/bin/bash
username=$1
password=$2

response=$(curl --cookie-jar vk.txt "https://oauth.vk.com/authorize" --data "client_id=<app_id>&redirect_uri=https://oauth.vk.com/blank.html&display=mobile&scope=video,audio&response_type=token&v=5.44&revoke=1")
echo "response is $response"
echo "================================================================="
response=$(curl --request POST --cookie vk.txt "https://login.vk.com/?act=login&soft=1&utf8=1" --data-urlencode "_origin=https://oauth.vk.com&ip_h=<some_value>&lg_h=<some_value>&to=<some_value>&email=<my_email>&pass=<my_pass>")
echo "response is $response"
echo "================================================================="

exit 0