Initial checkin
This commit is contained in:
18
getNewRefreshToken.sh
Executable file
18
getNewRefreshToken.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
myIP=$(ip a | grep 'inet.*192.168.10' | awk -F "[ /]*" '{print $3}')
|
||||
curl -s "https://ddns.kawomi.com/?domain=cstradebotcallback&address=${myIP}"
|
||||
echo
|
||||
|
||||
echo OPEN URL: "https://api.schwabapi.com/v1/oauth/authorize?client_id=$(<appKey.dat)&redirect_uri=https://cstradebotcallback.ddns.kawomi.com/"
|
||||
echo
|
||||
theCode=$(sudo ./codeReceiveServer.py)
|
||||
echo Code is $theCode
|
||||
|
||||
curl -s -X POST "https://api.schwabapi.com/v1/oauth/token" \
|
||||
-H "Authorization: Basic $(<appCredentials.dat)" \
|
||||
-H 'Content-Type: application/x-www-form-urlencoded' \
|
||||
-d "grant_type=authorization_code&code=${theCode}&redirect_uri=https://cstradebotcallback.ddns.kawomi.com/" > temp/refreshTokenReqResp.$$.json
|
||||
jq -r .refresh_token temp/refreshTokenReqResp.$$.json > refresh_token.dat
|
||||
echo Refresh Token: $(<refresh_token.dat)
|
||||
|
||||
Reference in New Issue
Block a user