mirror of
https://gitea.phreedom.club/localhost_frssoft/FMN_bot.git
synced 2024-11-23 05:33:01 +00:00
Attempt fix auth helper
This commit is contained in:
parent
e7c586e26e
commit
b5f2caf749
@ -17,13 +17,14 @@ export instance_point="https://$instance/api/v1"
|
||||
|
||||
auth_api_create_client()
|
||||
{
|
||||
mkdir -m 711 -p ".app_sessions"
|
||||
if [ ! -e ".app_sessions/$instance" ]; then
|
||||
curl -s --compressed --url "$instance_point/apps" \
|
||||
--data-urlencode "client_name=$client_name" \
|
||||
--data-urlencode 'redirect_uris=urn:ietf:wg:oauth:2.0:oob' \
|
||||
--data-urlencode 'scopes=read write follow' \
|
||||
--output ".app_sessions/$instance" \
|
||||
--create-file-mode 0600
|
||||
--output ".app_sessions/$instance"
|
||||
chmod 600 ".app_sessions/$instance"
|
||||
fi
|
||||
}
|
||||
|
||||
@ -31,6 +32,7 @@ auth_api_get_code()
|
||||
{
|
||||
auth_api_create_client
|
||||
client_id=$(jq -r '.client_id' ".app_sessions/$instance")
|
||||
echo "Auth link (if fail) https://$instance/oauth/authorize?client_id=$client_id&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=read+write+follow"
|
||||
default_auth_browser "https://$instance/oauth/authorize?client_id=$client_id&response_type=code&redirect_uri=urn:ietf:wg:oauth:2.0:oob&scope=read+write+follow"
|
||||
echo 'Input token-code:'
|
||||
read pass
|
||||
@ -49,10 +51,11 @@ auth_api_get_token()
|
||||
--data-urlencode "redirect_uri=urn:ietf:wg:oauth:2.0:oob" \
|
||||
--data-urlencode 'scope=read write follow' \
|
||||
--data-urlencode "code=$pass" | jq -r '.access_token')
|
||||
echo > "$basedir"/.auth
|
||||
chmod 600 "$basedir"/.auth
|
||||
echo "$token" > "$basedir"/.auth
|
||||
echo > .auth
|
||||
chmod 600 .auth
|
||||
echo "$token" > .auth
|
||||
}
|
||||
|
||||
auth_api_get_token
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user