JeremyDunn / php-fedex-api-wrapper

This library provides a fluid interface for constructing requests to the FedEx web service API.
269 stars 184 forks source link

Authentication error #67

Closed atmangel closed 5 years ago

atmangel commented 6 years ago

Hi Jeremy, thank you very much for this tool, i have installed it with composer, but when i execute by example the track-by-id.php script i get next error:

object(FedEx\RateService\ComplexType\RateReply)#27 (2) { ["name":protected]=> string(9) "RateReply" ["values":protected]=> array(4) { ["HighestSeverity"]=> string(5) "ERROR" ["Notifications"]=> array(1) { [0]=> object(FedEx\RateService\ComplexType\Notification)#39 (2) { ["name":protected]=> string(12) "Notification" ["values":protected]=> array(4) { ["Severity"]=> string(5) "ERROR" ... etc

I have seted my fedex info in credentials.php , but this info is in test mode.

define('FEDEX_ACCOUNT_NUMBER', '510087240'); define('FEDEX_METER_NUMBER', '119024370'); define('FEDEX_KEY', 'o0hwrrN6w0OIseO8'); define('FEDEX_PASSWORD', 'xxxSomePassxxx');

thanks in advance!

chrismagneti commented 6 years ago

I receive the same error attempting to use the Address Verification service.

jeremyarntz commented 6 years ago

I am having the same issue using the Address Verification service.

cgsmith commented 6 years ago

Just adding what I tried. It appears to work for me. I am just using the address validation example with FedEx Test API key and it appears to work fine with the example. Here is the response:

object(FedEx\AddressValidationService\ComplexType\AddressValidationReply)#20 (2) {
  ["name":protected]=>
  string(22) "AddressValidationReply"
  ["values":protected]=>
  array(6) {
    ["HighestSeverity"]=>
    string(7) "SUCCESS"
    ["Notifications"]=>
    array(1) {
      [0]=>
      object(FedEx\AddressValidationService\ComplexType\Notification)#33 (2) {
        ["name":protected]=>
        string(12) "Notification"
        ["values":protected]=>
// Trimmed
chrismagneti commented 6 years ago

Yes. How do you run with Production Credentials? I haven't see anything in this API wrapper for setting it to production.

cgsmith commented 6 years ago

@chrismagneti see this example

WrightAaronM commented 6 years ago

I was having this problem until I realized I was using the wrong password. The password field is NOT your password you use to login to the FedEx website. When you created your test API key you should have received an email that had a TestPassword included. That's what you want to use for testing the API. I switched to that and it started working.

atmangel commented 6 years ago

Hi, i started this issue and i solved this issue with the password that i received in my email, if you have the same issue, check your email.

kumar1010sumit commented 5 years ago

Works correctly with test credential but authentication failed with production credentails. Where I am wrong.

JeremyDunn commented 5 years ago

@kumar1010sumit Point the SoapClient to the production URL. See here for an example:

https://github.com/JeremyDunn/php-fedex-api-wrapper/blob/master/examples/rate-request.php#L78

Orion7agency commented 5 years ago

Hey @JeremyDunn I have point the SoapClient to the prod URL, yet I get this error [0] => FedEx\OpenShipService\ComplexType\Notification Object ( [name:protected] => Notification [values:protected] => Array ( [Severity] => ERROR [Source] => prof [Code] => 1000 [Message] => Authentication Failed )

cgsmith commented 5 years ago

@Orion7agency What does your code look like? Minus any credentials of course...

Orion7agency commented 5 years ago

Thanks @cgsmith

$rateServiceRequest = new Request(); $rateServiceRequest->getSoapClient()->__setLocation(Request::PRODUCTION_URL); //use production URL

// web authentication detail $createOpenShipmentRequest->WebAuthenticationDetail->UserCredential->Key = ''; $createOpenShipmentRequest->WebAuthenticationDetail->UserCredential->Password = ''; // client detail $createOpenShipmentRequest->ClientDetail->MeterNumber = ''; $createOpenShipmentRequest->ClientDetail->AccountNumber = ''; // version $createOpenShipmentRequest->Version->ServiceId = 'ship'; $createOpenShipmentRequest->Version->Major = 15; $createOpenShipmentRequest->Version->Intermediate = 0; $createOpenShipmentRequest->Version->Minor = 0;

Orion7agency commented 5 years ago

is that what you wanted @cgsmith

cgsmith commented 5 years ago

Where did you get the version information for the ship service?

Orion7agency commented 5 years ago

I got it from here fedex_ex\examples\create-open-shipment.php

$createOpenShipmentRequest->Version->ServiceId = 'ship'; $createOpenShipmentRequest->Version->Major = 15; $createOpenShipmentRequest->Version->Intermediate = 0; $createOpenShipmentRequest->Version->Minor = 0;

cgsmith commented 5 years ago

Everything looks fine on that side. I would verify other options work or consult with Fedex.

senter-logistics commented 4 years ago

This error is due to Fedex credentials errors, you must to contact fedex to solve the problem. Even tho you can generate your keys, you need to send an email to tsc@corp.ds.fedex.com requesting the activation.

TonyTheFerg commented 9 months ago

Was having the same issues with good credentials.

This worked:

// Use production URL.
$request->getSoapClient()->__setLocation(Request::PRODUCTION_URL);