Refresh token expiration

Hello,

I need to know how to refresh the refresh_token once it has expired. I receive this message when the refresh_token has expired:
image

I don’t want my users to see this message when they use my application.
According to the documentation, when the refresh_token expires, do I have to request a new access_token? Does this mean that the user of my application will need to delete and then restart the authentication process? This doesn’t seem very practical to me. What can I do?
For your information, I am developing my application in PHP.

Hey @Romain , have you tried refreshing the tokens when they expire through this endpoint ?Pipedrive API v1 Reference

Yes, but the refresh_token expires after 60 days if it hasn’t been refreshed. What should I do in that case?

unfortunately refresh tokens are designed to expire if not used for a while so the user needs to continue using the app to refresh them. maybe you can consider adding a “re-authorize” button to the ui that appears when the refresh token is expired ? , the user just has to re-authorize the pipedrive tokens to get new ones but doesn’t necessarily need to uninstall the app

Could you please provide me with a solution to check if the refresh_token has expired? And how can I display a button to reauthorize in my JSON Panel in PHP?
Because I can’t manage to edit the error message :
image

Would someone have the solution to my problem, please? :slight_smile:

Hey Romain, my initial thought was to add it as a button in the panels actions menu but after thinking about it some more it might not be the best option as it would display for both non authorized users and already authorized users. You brought up an interesting case though and we’ll look into improving/adding error handling for expired tokens in the UI. in the meantime maybe you can alternatively look into the panel error handling section and see if it can help solve the issue you’re facing

Thank you @youssef_s for your response I will do what is necessary. :+1:t2:

Hello @youssef_s I was able to solve my issue by prompting the user to reinstall the application via a button based on the error returned by Pipedrive, and it works successfully.

image

I’m sharing my experience in hopes of helping others who probably had the same problem as me. :slight_smile: