codingbadger / instant-tokens.com

11 stars 0 forks source link

Returing a JS file #2

Closed mbardelmeijer closed 4 years ago

mbardelmeijer commented 4 years ago

Hey, awesome service. Question: could the response be modified to return a javascript file that sets the token?

So for instance:

<script src="https://ig.instant-tokens.com/users/XXXXXXXXXXXXXXXXXXXXXXXXX/instagram/XXXX/token.js"></script> -> returns var InstagramToken = 'TOKENXXXXXXXXXX';

Then on the page, we can include this JS: See example of <script src='https://(your-token-app-name).herokuapp.com/token.js'></script>

And the variable is set directly without needing to do a ajax request: <script>alert(InstagramToken);</script>

codingbadger commented 4 years ago

I have updated the API to handle this. As requested the response sets a variable called InstagramToken to the value of the current Access Token.

The end point to use in your script tag is in the format of:

https://ig.instant-tokens.com/users/{userId}/instagram/{instagramUserId}/token.js?userSecret={userSecret}

I'll update the wiki and site in the next week or so.

codingbadger commented 4 years ago

The site has no been updated to display this information

image