I am trying to integrate v3 API on my website I was able to get it working on my localhost
i have a custom php template in wordpress I am having a difficult time trying to figure out
1)how can I generate the code on the server as I want the code to be generated automatically without me clicking on the generated url
2)also generate auth token automatically
You do not have to generate an authentication code more than once. Once you get the Access/Refresh Token for the first time I suggest you store that so it can be accessed when you need it to make an API call. You can then use the Refresh Token as needed to generated a new Access/Refresh Token and replace those with your original set that you stored.
I have had the same issue saving the refresh token such that it does not expire to solve this you need to make table in db save the token then setup a cronjob for every hour to refresh the token use system cron instead of wordpress as it will be a little more relaible if you have diffculties you can follow this guide https://www.wpscreators.com/simple-wordpress-custom-constant-contact-api/