2017-04-02 52 views
0

我試圖執行一個兩個足驗證 - 嘗試執行以下命令來獲得訪問令牌錯誤的請求,而歐特克Forge的訪問令牌

$ /cygdrive/c/xampp/apache/bin/curl.exe -v 
     'https://developer.api.autodesk.com/authentication/v1/authenticate' -X 'POST' -H 'Content-Type: application/x-www-form-urlencoded' -d 
     'client_id=****clientid*****& client_secret=****clientsecret******& grant_type=client_credentials& scope=data:read' 

我得到如下回應:

 Note: Unnecessary use of -X or --request, POST is already inferred.   
      % Total % Received % Xferd Average Speed Time Time  Time Current 
             Dload Upload Total Spent Left Speed 
      0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0*   Trying 34.251.61.88... 
     * Connected to developer.api.autodesk.com (34.251.61.88) port 443 (#0) 
     * Cipher selection: 
     ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH 
     * successfully set certificate verify locations: 
     * CAfile: C:\xampp\apache\bin\curl-ca-bundle.crt 
     CApath: none 
     * TLSv1.2 (OUT), TLS Unknown, Certificate Status (22): 
     } [5 bytes data] 
     * TLSv1.2 (OUT), TLS handshake, Client hello (1): 
     } [512 bytes data] 
     0  0 0  0 0  0  0  0 --:--:-- 0:00:01 --:--:--  
     0* TLSv1.2 (IN), TLS handshake, Server hello (2): 
     { [89 bytes data] 
     * TLSv1.2 (IN), TLS handshake, Certificate (11): 
     { [3086 bytes data] 
     * TLSv1.2 (IN), TLS handshake, Server key exchange (12): 
     { [333 bytes data] 
     * TLSv1.2 (IN), TLS handshake, Server finished (14): 
     { [4 bytes data] 
     * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): 
     } [70 bytes data] 
     * TLSv1.2 (OUT), TLS change cipher, Client hello (1): 
     } [1 bytes data] 
     * TLSv1.2 (OUT), TLS handshake, Finished (20): 
     } [16 bytes data] 
     * TLSv1.2 (IN), TLS change cipher, Client hello (1): 
     { [1 bytes data] 
     * TLSv1.2 (IN), TLS handshake, Finished (20): 
     { [16 bytes data] 
     * SSL connection using TLSv1.2/ECDHE-RSA-AES128-GCM-SHA256 
     * Server certificate: 
     *  subject: jurisdictionC=US; jurisdictionST=Delaware; 
     businessCategory=Private Organization; serialNumber=2401504; C=US; 
     postalCode=94903; ST=California; L=San Rafael; street=111 McInnis Parkway; 
     O=Autodesk, Inc.; OU=PDG; CN=developer.api.autodesk.com 
     *  start date: May 17 00:00:00 2016 GMT 
     *  expire date: May 17 23:59:59 2017 GMT 
    *  subjectAltName: developer.api.autodesk.com matched 
     *  issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; 
    CN=Symantec Class 3 Extended Validation SHA256 SSL CA 
    *  SSL certificate verify ok. 
     0  0 0  0 0  0  0  0 --:--:-- 0:00:01 --:--:--  
     0} [5 bytes data] 
     > POST /authentication/v1/authenticate HTTP/1.1 
     > Host: developer.api.autodesk.com 
     > User-Agent: curl/7.47.1 
     > Accept: */* 
     > Content-Type: application/x-www-form-urlencoded 
     > Content-Length: 125 
> 
     } [125 bytes data] 
     * upload completely sent off: 125 out of 125 bytes 
     { [5 bytes data] 
     < HTTP/1.1 400 Bad Request 
     < Content-Type: application/json 
     < Date: Sat, 01 Apr 2017 09:13:17 GMT 
     < Server: Apigee Router 
    < Content-Length: 221 
     < Connection: keep-alive 
    < 
     { [221 bytes data] 
     100 346 100 221 100 125 114  64 0:00:01 0:00:01 --:--:- 
     - 115{"developerMessage":"The required parameter(s) 
      client_secret,grant_type not present in the 
      request","userMessage":"","errorCode":"AUTH-008","more 
     info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH- 
     008"} 
     * Connection #0 to host developer.api.autodesk.com left intact 

爲什麼在輸出中會出現< HTTP/1.1 400錯誤請求?

回答

0

請務必在您的要求刪除空的空間,特別是在-d參數,之後&

$ /cygdrive/c/xampp/apache/bin/curl.exe 
-v 'https://developer.api.autodesk.com/authentication/v1/authenticate' 
-X 'POST'-H 'Content-Type: application/x-www-form-urlencoded' 
-d 'client_id=***&client_secret=***&grant_type=client_credentials&scope=data:read' 
相關問題