Answer the question
In order to leave comments, you need to log in
What is the correct way to call the mediatype.post method with OAuth2 authentication?
var data = JSON.stringify({ media: { type: 'text', text: text }});
var p = {
application_key: scope.AppInfo.PublicKey,
attachment: data,
method: 'mediatopic.post',
type: 'USER'
};
var sigParams = params(p, false);
var sigParamsCleared = sigParams.replace(/&/g, '');
var sigParamsClearedWithSecret = sigParamsCleared + scope.AppInfo.PrivateKey;
p.sig = md5(sigParamsClearedWithSecret);
p.access_token = scope.AuthInfo.access_token;
var request = 'http://api.ok.ru/fb.do?' + params(p);
return $http.post(request);
Answer the question
In order to leave comments, you need to log in
At first glance, instead of the application secret
var sigParamsClearedWithSecret = sigParamsCleared + scope.AppInfo.PrivateKey;
there must be a secret session key (which was obtained via OAUTH) which, judging by the variables, probably lies in scope.AuthInfo.*Key. Try:
var sigParamsClearedWithSecret = sigParamsCleared + scope.AuthInfo.PrivateKey;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question