How to clear Twitter card cache with api? - twitter

I am looking for way to clear of twitter card cache using api
I am aware of this tool of Twitter helps in clearing the cache of the cards
https://cards-dev.twitter.com/validator
I am looking for a way to integrate this process into my application.
What I am looking for is something similiar to what facebook offers (https://developers.facebook.com/docs/sharing/opengraph/using-objects#update)
I did try a simple code like below which happens in the twitter's tool. but I get 403 authorized. Is there a way to to authorize the below request ?
$(document).ready(function(){
$.post(
"https://cards-dev.twitter.com/validator/validate",
{
"url" : "http://superbotics.com",
"platform" : "Swift-12",
"authenticity_token" : "tkWubiFOndkChH58oJmophrLlVoQqbQmY3QZFTayFK6uq"
},
function(data){
console.log(data);
}
);
});
Any help is appriciated

Here is an answer to the question. The follow up of the same in Twitter community
https://twittercommunity.com/t/how-to-clear-twitter-card-cache-with-api/62974
hope this would answer the question

Related

Simple example of Twitter api request

Could someone just show an example of simple twitter api request?
Apparently, i'm setting wrong headers, but i don't get what exactly is wrong.
URL:
'https://api.twitter.com/1.1/followers/ids.json?username=J7mbo'
Request headers:
{
'oauth_access_token': '...'
'oauth_access_token_secret': '...'
'consumer_key': '...'
'consumer_secret': '...'
}
Please, don't overcomplicate this with language-specific snippets or additional libraries. All i need is working REST api request.
If it's important, i'm using superagent, which means JavaScript.
If you are logged in and have a Application already registered then the form at the bottom of the page will show you an example.
https://dev.twitter.com/rest/reference/get/followers/ids
Any concrete example with specific headers would leak access to a twitter account and be invalid soon due to time stamps in the signing process.

Why is linkedIn adding a pound exclamation mark (hashbang) to my URL?

When sharing a link I've noticed that linkedIn appends a '#!' to the end of the URL after redirecting. This is breaking my Backbone.js single-page app since we use pushstate in the URL, and so the '!' is interpreted as a Backbone.js route.
Here is an example link (not my site). It will take you to:
http://blog.mindresearch.net/blog/bid/336633/The-Connection-Between-Math-and-Neuroscience#!
I know I can filter this on the server-side, or deal with it on the client-side in numerous ways, but it just seems strange, and I saw no posts online about this topic, so thought I'd post a question asking what it is, and whether there is a way to get rid of it?
Of course, I'll also email LinkedIn support, but thought this could be useful to anyone else running into the same problem.
AFAIK anything after the hash is not sent to the server; I use a simple client-side script to redirect those URLs. A naive redirect, but it works. I don't see any way of preventing it from occurring, unless LinkedIn and Facebook change their outgoing redirect policy.
<script>
if( window.location.hash == '#!' ) {
window.location.href = 'http://domain.tld/';
}
</script>
Sure it only works for JavaScript enabled clients, but then again in my experience those hashbang URLs only break those clients in the first place.

vBulletin mobile API login_login?

I'm new bigginer in vBulletin and I can not find a solution for my problems, I explain,
I would like to create an iOS application that runs with Mobile API vBulletin 5.0, but Now, leave aside iOS.
I would like to create a PHP code that authenticates a user, I already managed to get the result of api_init () so I can use the following vars apiclientid, secret and apiaccesstoken, but I didn't find solution to login a user, I'm calling the method login_login on the api but it return null !
please can someone help on how we can login ? this will be really helpfull,
thank you.

MVC4 Get user Tweets, alternative to v1 (deprecated)

Using MVC4, I would like to get the recent Tweets (3) of user's without having to request access from them, because that is a pain for the user. This is also because a user may be viewing another user and I would also like to display their Tweets.
This was fairly simple with Twitter API v1:
$.ajax({
url: 'https://api.twitter.com/1/statuses/user_timeline.json?count=3&screen_name=' + twitterUser,
...
});
..but its deprecated and will stop working in about two months from now.
I'm new to Oauth and have struggled to find any good material on how to get a user's Tweets, but I believe the process is a lot more complicated now with the Twitter API v1.1? Ideally, I'd like to achieve everthing in the front end, but think that I now need to do some authentication server side and will have to use MVC?
In order to get any user's Tweets, I was thinking that I could create a Twitter account for my application and use that to get anyone's Tweets, as long as they are not protected.
Does anyone know of any good libraries that I can use to achieve this, or is the out of the box MVC4 Oauth stuff alone enough to do the job?
Any suggestions of where to start, and especially examples would be greatly appreciated.
To use API 1.1, you have to have a Twitter account and a Twitter application and then use OAUTH to authenticate your rate limited requests using GET statuses/show/:id. The only alternative I know is RSS which both Twitter & Facebook have kiiled, briught back and threatened to kill again:
http://api.twitter.com/1/statuses/user_timeline.rss?screen_name={USERNAME}
I decided to use Linq2Twitter, as this makes use of the V1.1 API.
An MVCDemo example of Linq2Twitter stores the authorised credentials in a SessionStateCredentials object, but I can store the object in cache and persist the authorisation for all users, meaning they won't have to authorise anything. Provided that a user's Tweets aren't protected, the Tweet's for any user should be retrievable this way.

How do I make a "signup with Github" button like the one on Coderwall?

Is there any documentation about using github to authenticate users on my site? Preferably in PHP.
Like the button here: http://coderwall.com/
Yes, it's documented in the OAuth section of the GitHub API documentation.
There's also an example implementation in Github's documentation guides.
The example provided by Github and shared by Adrian Petrescu is great and is as simple as it gets.
However, I find that most OAuth examples are missing 2 things:
How to create a proper 'Login with ....' button on your page. Sounds easy but if you google around, you will encounter mostly CSS hacks, which is not ideal
A sandbox with all the pieces of OAuth code that is already up and running so that you can poke around it to get a better understanding. Without this, an OAuth newbie has to spend hours trying to setup different pieces (OAuth provider app, front-end, back-end), before he can get started. More likely than not she may make a mistake in one of the pieces, and spend hours debugging it.
So we created this jsfiddle (https://jsfiddle.net/dg9h7dse/30/), with accompanying detailed explanation here on coderwall. You can use this immediately to test out an OAuth provider's API endpoints.
I'll summarize it here:
To create a nice social button
Use bootstrap (http://getbootstrap.com), font-awesome (https://fontawesome.io), bootstrap-social (https://lipis.github.io/bootstrap-social/)
Add this snippet:
```
<a id="github-button" class="btn btn-block btn-social btn-github">
<i class="fa fa-github"></i> Sign in with GitHub
</a>
```
For us to put the demo code on jsfiddle for people to play around with, we needed a front-end only OAuth solution, so we use https://oauth.io, which has a Javascript front-end only library (https://github.com/oauth-io/oauth-js) that works with the service.
NOTE: https://oauth.io is a paid-service but lets you integrate with hundreds(?) of OAuth providers without writing backend code.
All we need to do then is to bind our nice social login button to a Javascript snippet that calls the OAuth service provider.
```
$('#github-button').on('click', function() {
// Initialize with your OAuth.io app public key
OAuth.initialize('YOUR OAUTH.IO PUBLIC KEY');
// Use popup to prompt user for their OAuth provider credentials
OAuth.popup('github').then(github => {
// If login is successful,
// retrieve user data from oauth provider
console.log(github.me());
});
})
```
Hope this helps more people to understand and get started on using OAuth.

Resources