简体   繁体   中英

PHP/cURL REST 401 / Message Failed

Okay so I get this error:

 {"Code":401, "Errors":[{ "Message":"Web request to 'http:\\/\\/silverstagingapi.ncrsmblab.com\\/oauth2authorizationserver\\/OAuth2\\/Token' failed."}], "GUID":"00000000-0000-0000-0000-000000000000", "IsSuccessful":false, "Message":"Web request to 'http:\\/\\/silverstagingapi.ncrsmblab.com\\/oauth2authorizationserver\\/OAuth2\\/Token' failed.", "Result":null} 

IT SHOULD look like this:

 { "Code": 200, "Errors": [], "GUID": "00000000-0000-0000-0000-000000000000", "IsSuccessful": true, "Message": null, "Result": { "AccessToken": "gAAAACDf3PAniQx1BqJ8qKZVlTQEP7JpvOYglvk8dsBV80mWxtmRCHc1CouejnKbsXEgYbOLXjN7rdZo-Bz535wdulxgkxRTmnEBTSgdZo-DkBHrp-HeiwjlBt_uSIhH7IdIr5dU0w4M_6KgUBI5e1_GWClDHvZY8R5GQahkpy24TGAp9AAAAIAAAAA11W-Eg", "AccessTokenExpirationUtc": "/Date(1445616318650)/", "AccessTokenIssueDateUtc": "/Date(1445612718666)/", "Callback": null, "RefreshToken": null, "Scope": [ "APIUSER" ] } } 

http://pastebin.com/Ryje2B8H

StackOverflow keeps saying the code is unformatted despite Ctrl+K and code tags so I linked to a syntax-highlighted pastebin. The fact I get a JSON Response means the API is functioning / responding. But it doesn't give me anything but a 401 to go off of. I tried fsockopen() before trying curl and it flat out refused the connection. Using cURL I get a response but it fails regardless.

Figured it out. The API was limited to 3 specific software partners so it doesn't matter what keys/secrets/data I have. The API only accepts requests from specific domains or vendors it seems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM