Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

curl - I'm trying to get access token from an API, and I'm getting some errors on my VPS, but it's working well on my local computer

The command that I've executed is:

curl --location --request POST 'URL_HERE' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'assertion=Bearer JWT_TOKEN_HERE' --data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer'

On my VPS

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                               Dload   Upload  Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   152  100   152    0     0   1876      0 --:--:-- --:--:-- --:--:--  1876

{
 "status": 401,
 "code": "invalidToken",
 "message": "The Authorization token is not valid.",
 "traceId": "CLIENT_ID_HERE",
 "internal": "nil"
}
curl: (3) Host name ' --header' contains bad letter
curl: (3) Port number ended with ' '
curl: (3) Host name ' --data-urlencode' contains bad letter
curl: (3) Host name 'assertion=Bearer JWT_TOKEN_HERE
curl: (3) Host name ' --data-urlencode' contains bad letter
curl: (3) Port number ended with 'i'

On my Local Computer

{
 "access_token": "Bearer ACCESS_TOKEN_HERE",
 "expires_in": 3600,
 "api_domain": "URL_HERE",
 "token_type": "Bearer"
}
question from:https://stackoverflow.com/questions/65861465/im-trying-to-get-access-token-from-an-api-and-im-getting-some-errors-on-my-vp

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...