Uncaught exception 'CheddarGetter_Response_Exception' with message 'Not Authorized

Mike Keen's Avatar

Mike Keen

20 Aug, 2009 09:51 PM

I'm getting the following PHP error:

Fatal error: Uncaught exception 'CheddarGetter_Response_Exception' with message 'Not Authorized: Authentication required' in /html/application/libraries/CheddarGetter.php:776 Stack trace: #0 /html/application/libraries/CheddarGetter.php(576): CheddarGetter_Response->handleError() #1 /html/application/libraries/CheddarGetter.php(299): CheddarGetter_Response->__construct('<?xml version="...') #2 /html/application/controllers/test.php(10): CheddarGetter->newCustomer(Array) #3 [internal function]: Test->index() #4 /html/system/codeigniter/CodeIgniter.php(232): call_user_func_array(Array, Array) #5 /html/dispatch.php(117): require_once('/usr/share/ngin...') #6 {main} thrown in /html/application/libraries/CheddarGetter.php on line 776

I'm pretty sure I provided the API with the correct login information. It's the email address and password I use to log into my dashboard. Now, I don't remember the product code I set when I created the product, and can't find it anywhere in the dashboard, so I am wondering if maybe I am passing the wrong one. Could that be the issue?

  1. Support Staff 1 Posted by Marc Guyer on 20 Aug, 2009 10:28 PM

    Marc Guyer's Avatar

    Hey Mike -- Yeah, I've seen this error today. The easiest way to test the api is from the command line using cURL. Try this:

    curl -u yourUsername:yourPassword https://cheddargetter.com/xml/plans/get
    

    You should receive this response:

    <?xml version="1.0" encoding="UTF-8"?><error code="400">Bad request: No product selected. Need a productId or productCode.</error>
    

    Then, you can throw your product code in there to get something meaningful:

    curl -u yourUsername:yourPassword https://cheddargetter.com/xml/plans/get/productCode/YOUR_PRODUCT_CODE
    

    If you're username:password is incorrect, you'll get this:

    <?xml version="1.0" encoding="UTF-8"?><error code="401">Not Authorized: Authentication required</error>
    

    You can also use wget but it's a little less friendly:

    wget --http-user=yourUsername --http-password=yourPassword --no-check-certificate http://cheddargetter.com/xml/plans/get/productCode/YOUR_PRODUCT_CODE
    

    If you're on Windows, you can get curl here but I've never tried that. There are other tools for Windows but, again, I haven't used any of them.

  2. 2 Posted by Mike Keen on 20 Aug, 2009 10:54 PM

    Mike Keen's Avatar

    Thanks Marc. That was very helpful. I am now getting the following error in CURL:

    <?xml version="1.0" encoding="UTF-8"?><error code="401">Not Authorized: API Access unauthorized.</error>
    

    Is my account not authorized to access the API? The only reason I can figure for this is that I haven't entered my authorize.net information into my dashboard yet. This is because I'm still in the process of getting that established. If at all possible, I'd really like to be able to test the API before I input that.

  3. 3 Posted by Mike Keen on 20 Aug, 2009 11:22 PM

    Mike Keen's Avatar

    Thanks Marc. That was very helpful. It will be nice to test things via the command line instead of PHP.

    Now I've got it giving me a completely different error message.

    <?xml version="1.0" encoding="UTF-8"?><error code="401">Not Authorized: API Access unauthorized.</error>
    

    Does my account not have access to the API for some reason? Could it be because I haven't provided my Authorize.net account information yet? If so, is there any way to make an exception? I'm trying to launch my product, and I'd really like to get all the customer management stuff finalized and I don't want to wait for that account to be established. It's in the process of being opened, but I think it will be a week or so before all that is finalized.

    Apologies if this is a duplicate post. It looks like Tender went down just as I posted my last reply.

  4. 4 Posted by Mike Keen on 21 Aug, 2009 07:16 PM

    Mike Keen's Avatar

    Thanks Marc. Your answer was very helpful.

    I've now been able to verify that I am using all of the correct login/product information using the debugging methods you suggested. However, I'm now running into the following error message:

    <error code="401">Not Authorized: API Access unauthorized.</error>
    

    I was getting this one when I was using the incorrect login information:

    <error code="401">Not Authorized: Authentication required</error>
    

    So clearly (to me) my account doesn't have access to the API for some reason. Is this because I haven't given you guys my Authorize.net information yet? The reason I haven't provided it is because we're still in the process of getting that account established. Is there any way we can get access to the API in the meantime in order to finalize our customer stuff for our Website?

    FYI, this is the third time I've tried to post this message. I think Tender is having some serious issues ATM.

  5. Support Staff 5 Posted by Marc Guyer on 21 Aug, 2009 09:04 PM

    Marc Guyer's Avatar

    Mike -- You've found a bug. We've fixed it. You were unintentionally disallowed from using the API.

  6. Marc Guyer closed this discussion on 21 Aug, 2009 09:04 PM.

  7. Mike Keen re-opened this discussion on 21 Aug, 2009 09:08 PM

  8. 6 Posted by Mike Keen on 21 Aug, 2009 09:08 PM

    Mike Keen's Avatar

    Cool, thanks for looking into it and fixing this so quickly.

  9. Support Staff 7 Posted by Marc Guyer on 21 Aug, 2009 09:16 PM

    Marc Guyer's Avatar

    Hey -- No problem. We actually fixed it right after receiving your message but we all had to leave for a bit to dunk a friend of ours in a dunk tank.

  10. Marc Guyer closed this discussion on 21 Aug, 2009 09:16 PM.

  11. Mike Keen re-opened this discussion on 21 Aug, 2009 09:28 PM

  12. 8 Posted by Mike Keen on 21 Aug, 2009 09:28 PM

    Mike Keen's Avatar

    Far be it for me to ever come between a group of friends and a dunk tank! Happy Friday, and have a great weekend!

  13. Support Staff 9 Posted by Marc Guyer on 16 Mar, 2010 04:15 PM

    Marc Guyer's Avatar

    Mike -- We just discovered that a couple of your messages from back in August where caught as spam by Tender. Sorry we missed that. Are you still using CG? How are things going?

  14. 10 Posted by Mike Keen on 16 Mar, 2010 08:16 PM

    Mike Keen's Avatar

    Hey Marc,

    I am still planning to use it. The integration is all good to go. Just
    waiting for some funding-related things to fall into place, which should be
    soon.

    Thanks for checking in.

    Mike

  15. Marc Guyer closed this discussion on 18 Mar, 2010 08:52 PM.

  16. Marc Guyer re-opened this discussion on 17 May, 2010 08:32 PM

  17. Support Staff 11 Posted by Marc Guyer on 17 May, 2010 08:32 PM

    Marc Guyer's Avatar

    Hey Mike -- Just checking back in with you. I was curious whether anyone had created anything for CodeIgniter and ran across this post again. Did you use the PHP wrapper as-is or write your own or extend for CI or... ? How's everything else going?

  18. 12 Posted by Loren Davie on 12 Jul, 2010 10:31 PM

    Loren Davie's Avatar

    Hi - I'm getting the exact same behavior on an account I have - we also configured Authorize.net, and I'm confident we are using the correct username and password. I'm using the Python client (which works fine on other accounts).

    Any help would be most appreciated, thanks!

  19. Support Staff 13 Posted by Marc Guyer on 13 Jul, 2010 04:05 PM

    Marc Guyer's Avatar

    Hi Loren!

    Can you provide the exact error message and the exact time at which it occurs?

    Can you log into the CG GUI directly using the same username/password and access the same product?

  20. 14 Posted by Loren Davie on 13 Jul, 2010 07:00 PM

    Loren Davie's Avatar

    Hi Marc,

    The error message was a 401 Response "API Access Unauthorized". I have
    an occurrence of it on 7/11 around 6:25 PM EDT.

    I have been able to log into the GUI successfully using the same
    credentials. We've triple-checked to make sure we have no typos in the
    credentials.

    I just tried it again now, and I am not able to reproduce the error.
     Yesterday as of about 6:30 pm EDT I was able to reliably produce the error
    - perhaps you've changed something between then and now (its all the same on
    my end).

  21. Support Staff 15 Posted by Marc Guyer on 14 Jul, 2010 12:27 PM

    Marc Guyer's Avatar

    Loren -- Yes, we did fix your account. You should be good to go. Please do let us know if you have further problems!

  22. Marc Guyer closed this discussion on 14 Jul, 2010 12:27 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac