Deezer api options streaming duration - deezer

I'm getting some data of my Deezer account. When I'm trying to fetch my streaming_duration, it returns 0.
Besides, Deezer documentation is not accurate.
Does someone know why is this returning 0 ? Is this seconds or minuts?
My code is the following one :
$.ajax({
url: 'https://api.deezer.com/user/'+userid+'/options?access_token='+access_token,
success: function(response) {
console.log('Duration '+response.streaming_duration);
}
});

Deezer devs answered me by e-mail
The option streaming_duration is deprecated.

Related

Facebook javascript sdk return wrong user id

I am trying to get user information..and I'm using this method
FB.api('/me', function(response) {
console.log(response);
});
but the problem is that the response contains a wrong user_id.
Probably you're using Login 2.0 respectively the new JS SDK (https://developers.facebook.com/docs/javascript/quickstart/v2.0) and are getting an app-invidual user_id as described in the Graph API v2.0 Upgrading Guide:
https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids

Different Facebook access token JavaScript SDK

I'm quite confused with the access token from facebook..here is how I obtain the user's access token and use it to get data from graph API
window.fbAsyncInit = function() {
FB.init({
appId : 'app ID',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
FB.getLoginStatus(getStatus);
FB.Event.subscribe('auth.authResponseChange', getStatus);
function getStatus(response) {
if ( response.status === 'connected' ) {
var accessToken = response.authResponse.accessToken;
console.log("accessToken = " + accessToken);
$.ajax({
dataType : "jsonp",
type : "GET",
url : "https://graph.facebook.com/me/albums?access_token=" + accessToken,
success : function(data) {
$.each(data, function(index, value) {
console.log(index + ": " + value);
})
}
});
}
}
};
However, I always get an empty data. After I visit the graph API documentation here: https://developers.facebook.com/docs/reference/api/ and click on one of the graph links, I notice that the access token generated there is always different from what I retrieve from my code. For example, the current access token in the graph api documentation is
"AAAAAAITEghMBAMwuyHZCO3VOAvCm9hHpaZC9PGV9238ixsZB7zSfuplZBTZCLRj6cEViZADJlVcjOfInwvcbhqu3XBF1w4ZAxvPbexcGQZAYzb4bHAKsMbLF"
and the one in console log is
"AAAG0ZCFantJ8BAAFcMdDOyDyT4OBtjrvULEaS2o94gZAU7U1xITaogFXCZBghQP8G9bjEh3XSCATQOZCUSZCuNWFvEfypIAmcz9bkbk5qRBlHUZAOE4guW"
I think that I may have done this the wrong way. Can anyone help explain to me how to retrieve data from graph API in a correct way?
Any kinds of help will be appreciated. Thanks in advance :)
Run this URL with your authToken first:
https://graph.facebook.com/me/permissions?access_token=USER_ACCESS_TOKEN
You'll almost certainly only see basic permissions in the response, which is why you aren't getting the data from your call to the user's album.
You'll then want to run your user through the Authentication Process, making sure you request the permissions you need (probably 'user_photos' in your case).
More info is available in those two links. Good luck!
access token will never be the same. So that behaviour is correct.
Back to your problem , I think its mostly scope related issue.
I had developed a application using facebook c# sdk, In that application i did it like this:
when a post is to be submitted , redirect the user to facebook (with some parameters like appid, app-secret, auth-token and
redirect-url);
Facebook will ask the user to login with his credentials.
When the user is logged in, facebook will redirect back to the redirect-url. (with the authtoken and a new auth-code).
Then we should use this auth-code, app-id and app-secret and obtain the user-access-token. (This is done by doing a rest api call to the
url
https://graph.facebook.com/oauth/access_token?client_id=client_id&redirect_uri=redirect_uri&client_secret=client_secret&code=auth-code
This will return the user-token and expiry time for the token
And then we can post using this user-access-token to the fb.
Initially i had misunderstood the auth-code and used it as the user-access-token, and i always got the result as unauthorised token .
Please check whether this will help you or not.

Facebook-login issue

This is our link for the fb or old way sign-in: http://www.greeceinsiders.com/login
Does the fb-login work to you? When I click it it redirects me to the same page.
Sometimes it works sometimes not. When a user logs in with fb we collect his vredentials sucha as email,city, name in our mysql database. Does anybody had the same problem? Is there any good tutorial out there, that explains it step by step and is for the current fb api?
Any suggestions or feedback is welcome, thank you! Some code
FOUND IT!
I like to use the FB.login method. This allows me to set the permissions that I want (such as email) and access the info on my server through a Facebook library like https://github.com/facebook/php-sdk. There are also good tutorials on https://developers.facebook.com/docs/authentication/:
FB.login(
function(response) {
if (response.authResponse) {
$.ajax({
url: Global.base_url + 'user/facebook_log_in/',
dataType: 'json',
success: function(data) {}
});
}
else {
// Display facebook error
}
},
{
scope: 'email'
});

Use Facebook Graph Api to get info about comment?

I want to get info (text and uid) from comments in my application.
https://graph.facebook.com/commentID
I think I need my apps access token to get the comment info. How do I get it and echo/alert with comment's info?
you need to request the user to allow your application and then use the access token you get in the request to the Graph API...
the allow of the application can be done in both server side or Javascript (I prefer JS)
an example for how to allow an application and invoke a graph api call can be found in the facebook developers js sdk documentation below:
http://developers.facebook.com/docs/reference/javascript/FB.login/
function loginAndGetData(){
FB.getLoginStatus(function(response){
if(response.status=="connected"){
FB.Api("commentID",onGotData);
} else {
FB.Login(function(response){
if(response.status=="connected"){
FB.Api("commentID",onGotData);
}
});
}
});
}
function onGotData(data){
console.log(data)
}

log on to facebook through extension

I've already registered my app on Facebook developer and got an ID, but had hard time to characterize the my app(chrome extension), it's website app, mobile app, facebook app? What I wanna do is a simple extension that allows users simply to click on it, and the background JavaScript calls the Facebook API to ask the users to log in like this.
window.fbAsyncInit = function() {
FB.init({
appId : '123456789',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
};
chrome.browserAction.onClicked.addListener(function(tab) {
FB.login(function(response) {
if(response.authResponse) {
alert('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
console.log('Good to see you, ' + response.name + '.');
});
} else {
alert('User cancelled login or did not fully authorize.');
}
});
});
However, it pops up a window that says an error occurred, it is another way of saying "I am not authorized", how do I specify my app's URL on the Facebook developer page, because the extension's URL is a garbage like this chrome extension://asdjlajsldj/ or anyone knows any workaround? Thank you
I would assume that Facebook's API uses OAuth 2 to let applications access users data. Google provides a way of doing this with an example in their API section. I have also have posted an alternative method on GitHub. Note that my method will require some alternations to fit Facebook's interface but the idea is the same (I have a GitHub branch to do this with GitHub).
Essentially your extension must get an access token for the user from Facebook, then using this token as a parameter you can query private data from the API. What makes it seem difficult is the fact the the chrome extensions are sandboxed and have no return URL, but using one of the two methods above should do you just fine.
Good Luck!