Custom CRM - Refresh Token Unauthorized

Status
Not open for further replies.

chani

Platinum Partner
Joined
Jul 10, 2024
Messages
9
Reaction score
2
Hello,

I am having trouble with authenticating my custom CRM using oauth2 for version 20 of 3CX. After clicking 'authorize' and then 'test', I can perform a contact lookup once, but when I attempt to test again, I receive an unauthorized error message. I checked the logs and the new refresh token is supposedly 'set', but when the second test is performed it still uses the old refresh token.

What is strange is that I use this exact template for version 18 and it works fine with no issue.

This is what happens the first time I test after authentication in v20:
1720655980758.png
Note the refresh_token. It says it is set to the new refresh token at the end of the Auth scenario.

However, after my second attempt at doing a test lookup, the initial refresh_token is used:
1720655390089.png

Any help or advice would be appreciated :)
 
You will need to save the new refresh token when you get the access token. Check the template provided by 3CX for Kommo CRM which does exactly this. Also the Dynamics template does this.
 
Hi, thank you for your reply!

I have been using the Dynamics template as a reference and that is how I got it working on version 18. However, it does not seem to be working for version 20. Even though I update the refresh token in the Auth scenario, I am still getting the same unauthorized error.

I have attached my CRM in case I have configured it incorrectly for version 20.
 

Attachments

The template looks good to me, the updated refresh token should be being stored back to the 3CX config. Are you having this issue only while testing with the Test button? I think that in v20, with the new console, the updated token will not be stored in the 3CX configuration when you run a test like this, but it should work with real calls. Can you confirm that? Just Authorize, avoid running a test, and then make a couple of calls and confirm?
 
The template looks good to me, the updated refresh token should be being stored back to the 3CX config. Are you having this issue only while testing with the Test button? I think that in v20, with the new console, the updated token will not be stored in the 3CX configuration when you run a test like this, but it should work with real calls. Can you confirm that? Just Authorize, avoid running a test, and then make a couple of calls and confirm?
Yes it works with real calls, just not when I click test. Thank you!
 
That's what I thought! Good that you have it working. Be careful when running a test, because you will break the authorization in that case. Ensure that if you need to run a test, you execute the authorization again after that, so the integration keeps working.
 
  • Like
Reactions: chani
Status
Not open for further replies.