Weble / ZohoBooksApi

40 stars 41 forks source link

New Zoho-oauthtoken not supported #10

Closed xrobau closed 5 years ago

xrobau commented 5 years ago

At the moment, you only allow the old 'Zoho-authtoken' which they keep saying is going to be deprecated.

I had a quick hack at making it work by doing a if (strpos($this->authToken, '1000.') === 0) { .. then use 'Zoho-oauthtoken' } else { use 'Zoho-authtoken' } in Client.php, but you're doing some stuff with params that I found confusing, so I thought I'd open a ticket FIRST.

The new-hotness way of authenticating is to do their song and dance to get a refreshtoken, and then use that to generate an authtoken (You can avoid doing any work here by simply using $token = (new \ZCRMConfigUtil())->getAccessToken(); with the Zoho CRM SDK, after you've init'ed it.

Then you query like this:

curl https://books.zoho.com/api/v3/organizations \
  -H "Authorization: Zoho-oauthtoken 1000.41d9f2cfbd1b7a8f9e314b7aff7bc2d1.8fcc9810810a216793f385b9dd6e125f"

No other work required!

If I get time, I'll come back to it later, but I thought I should open the ticket first 8)

Skullbock commented 5 years ago

Hey! Thanks for the heads up. We already implemented the new auth method in the other zoho libraries we have:

If you would be so kind to PR the same change here, it would be awesome! Otherwise i'll try to move it next week

Thanks!

bluec commented 5 years ago

I might have a look at this. However, it struck me that since this functionality will be largely the same across each of the Weble Zoho SDK packages would it not be better to create a separate Zoho Oauth package that is then pulled in as a dependency?

Skullbock commented 5 years ago

Yes, that would be great. I'll try to put it together asap

On Tue, Sep 17, 2019 at 11:16 AM Chris N notifications@github.com wrote:

I might have a look at this. However, it struck me that since this functionality will be largely the same across each of the Weble Zoho SDK packages would it not be better to create a separate Zoho Oauth package that is then pulled in as a dependency?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Weble/ZohoBooksApi/issues/10?email_source=notifications&email_token=AAINRU23AS6IWXMXNTBBRC3QKCN5DA5CNFSM4HUYSPQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD634ATY#issuecomment-532136015, or mute the thread https://github.com/notifications/unsubscribe-auth/AAINRUYRWL74CX5LFXZQAELQKCN5DANCNFSM4HUYSPQQ .

-- [image: Logo Weble] Daniele Rosario

CTO Weble Srl Via Enrico Fermi, 265 36100 Vicenza ufficio: +39 0444 1454934 <003904441454934> mobile: +39 3283017134 <00393283017134> weble.it https://www.weble.it/ https://www.facebook.com/pages/Weble/110077192371908?fref=ts https://twitter.com/Webleit?lang=it https://www.linkedin.com/company/2470613?trk=tyah&trkInfo=clickedVertical%3Acompany%2Cidx%3A2-2-7%2CtarId%3A1432717146425%2Ctas%3Aweble https://www.instagram.com/weble.it/

Skullbock commented 5 years ago

Just released a tentative 3.0.0 with oauth 2 support and a common api client that's gonna be used on v2 of zoho crm apis as well. Can you check it out?

bluec commented 5 years ago

Wow, that was fast. The code looks clean but not had chance to test it yet. Will let you know once I have.

tm1000 commented 5 years ago

@Skullbock there is one issue right now with the 3.0.0 release that is this package requires weble/zohoclient on dev-master. In #18 I set that to version 1.0.0

Skullbock commented 5 years ago

Thanks! Should've been fixed now.

That teaches me never to push in a hurry :)