Answer the question
In order to leave comments, you need to log in
Why does the VK JavaScript SDK throw an error when sending a notification via secure.sendNotification?
Why does the VK JavaScript SDK throw an error when sending a notification via secure.sendNotification ?
VK.api("utils.getServerTime", {"v":"5.92"}, (data) => {
VK.api("secure.sendNotification", {"user_ids": ids ? ids : App.Data.Player.id, "user_id": App.Data.Player.id, "message": msg ? msg : "Test native message", "timestamp": data.response, "client_secret": params.get('access_token'), "v":"5.92"}, (data) => {
console.log(data);
if(data.response) {
showInfoPopup("Отправлено оповещение!");
}
});
});
error_code: 4
error_msg: "Incorrect signature"
Answer the question
In order to leave comments, you need to log in
secure.*
methods can only be called from the server. You are trying through client-side JS.
What they write about secure
methods:
This section provides administrative methods that can be called on behalf of an application using a third-party server. To use these methods, a special authorization scheme must be applied .
In addition to the standard parameters specified in the description of the methods, the client_secret parameter must be added to the request, containing the value from the "Secure key" field in the application settings.
Please note that test mode is not supported when working with secure methods!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question