Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
a2bb6a4f
Unverified
Commit
a2bb6a4f
authored
Feb 05, 2022
by
peterlh
Committed by
GitHub
Feb 05, 2022
Browse files
changed gettoken to use _post
changed gettoken to use _post instead of curl+jq
parent
38a19fa5
Changes
1
Hide whitespace changes
Inline
Side-by-side
dnsapi/dns_curanet.sh
View file @
a2bb6a4f
...
@@ -100,7 +100,16 @@ dns_curanet_rm() {
...
@@ -100,7 +100,16 @@ dns_curanet_rm() {
#################### Private functions below ##################################
#################### Private functions below ##################################
gettoken
()
{
gettoken
()
{
CURANET_ACCESS_TOKEN
=
$(
curl
-s
$CURANET_AUTH_URL
-d
"grant_type=client_credentials&client_id=
$CURANET_AUTHCLIENTID
&client_secret=
$CURANET_AUTHSECRET
&scope=dns"
| jq
-r
'.access_token'
)
response
=
"
$(
_post
"grant_type=client_credentials&client_id=
$CURANET_AUTHCLIENTID
&client_secret=
$CURANET_AUTHSECRET
&scope=dns"
"
$CURANET_AUTH_URL
"
""
""
)
"
if
!
_contains
"
$response
"
"access_token"
;
then
_err
"Unable get access token"
return
1
fi
CURANET_ACCESS_TOKEN
=
$(
echo
"
$response
"
| _egrep_o
"
\"
access_token
\"
:
\"
[^
\"
]+
\"
"
|
cut
-c
17-
)
CURANET_ACCESS_TOKEN
=
${
CURANET_ACCESS_TOKEN
::-1
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment