In facebook I can get the user’s authId relatively easily client-side. How would I do this via twitter on an AJAX site?
In the psudo-code below I get the Access Token if the user is logged in and pass that server side so I can do a server-side post. And if the user is not logged in/connected then facebook throws up a dialog that lets them log in, then returns (without refreshing the page) and executes a function that I can then get at the Access Token from.
Can this be done in twitter javascript, perhaps with @anywhere?
Thank you for your help!
if (FB) {
FB.getLoginStatus(function(response) {
if (response.status === ‘connected’) {
$.getJSON(window.page.services + “StoreAuthToken”, { type: “facebook”, socialId: response.authResponse.userID, authId: response.authResponse.accessToken, expiresInSeconds: response.authResponse.expiresIn }, null);
window.dialogs.loadFacebookOverlay({ href: href, image: image, description: description, socialId: response.authResponse.userID });
} else {
FB.login(function(response) {
if (response.status === ‘connected’) {
$.getJSON(window.page.services + “StoreAuthToken”, { type: “facebook”, socialId: response.authResponse.userID, authId: response.authResponse.accessToken, expiresInSeconds: response.authResponse.expiresIn }, null);
window.dialogs.loadFacebookOverlay({ href: href, image: image, description: description, socialId: response.authResponse.userID });
} else { /* user cancled */ }
}, { scope: ‘share_item’ });
}
});