Login with Envato Button



Hi fellow authors, can anyone help me here? I am trying to implement Envato Login functionality to be able to provide hassle-free way for our buyers to provide proof of purchase.

I have the online callback script that returns all the required purchase info. What I need is to return this information back to where it was requested from (the corresponding page in my theme). This is where I am stuck. Could not make it work with AJAX and include the returned info in response and now wondering if there are any other ways or has anyone been able to figure this out?
Thanks so much!


I faced this problem before and here you are how I solve it:

  1. Save the customer website on custom cookie before redirect them to the login page.

  2. Append the new data in the saved website URL for example xxxx .com/?purchase_code=xxxx&username=xxx

  3. After the login redirect back to the saved website and send the data to your AJAX script using get or post method

Remember to inform your customer you are using cookie


Hi BeSquares, thanks so much for your help!
The problem is, with the new API, I have to use my OAuth Client ID and token, as well as specify a callback url.
I created a php file on my server and if I do not use AJAX, I am able to receive all buyers purchases, however I cannot send the response back from where it originated. To do that, I need AJAX. But using AJAX leads to CORS problem + I cannot get the Envato login window show correctly. Is this something you’ve ever experienced I might shed some light on?
Thank you!


No token is not required only the ID and secret your APP should generate token, I don’t think it’s wise to send back all the returned information to your theme dashboard ( or where the user clicked )

Your login button should point to a file on your server in that file you will have some code like that:

header("Location: https://api.envato.com/authorization?response_type=code&client_id=".CLIENT_ID."&redirect_uri=".REDIRECT_URI."");

Where CLIENT_ID is defined on your file only not whiten your theme files and the REDIRECT_URI is the url on your Envato APP which is the same file to on your theme login button but with different parameters one for check other to send


This sounds promising, let me try it like that and get back to you. Once again, thanks so much for all your help!