Commit 2604b01c authored by Michael Tross's avatar Michael Tross

do not post and add scope to the authorize call

parent 42077b4d
......@@ -116,15 +116,11 @@ var vdc_get_client_id_callback = function(device, data)
return;
}
var url = "https://api.netatmo.net/oauth2/authorize?client_id=" +
client_id + "&redirect_uri=" +
encodeURIComponent(window.location.origin + "/" +
window.location.pathname) +
"&state=" + device.dSUID;
$("<form action=\"" + url + "\" method=\"POST\">" +
'<input type="hidden" name="aid">' +
'</form>').appendTo($(document.body)).submit();
var redirect_uri = encodeURIComponent(window.location.origin + window.location.pathname);
var url = "https://api.netatmo.net/oauth2/authorize?response_type=code&client_id=" +
client_id + "&redirect_uri=" + redirect_uri + "&state=" + device.dSUID + "&scope=read_station";
top.location.href=url;
}
var vdc_show_password_prompt = function(title, message, callback)
......@@ -204,6 +200,14 @@ var vdc_auth_button_clicked = function(dsuid, evt)
callback).fail(vdc_request_failed);
};
var vdc_auth2_button_clicked = function(dsuid, evt)
{
var redirect_uri = encodeURIComponent(window.location.origin + window.location.pathname);
var url = "https://api.netatmo.net/oauth2/authorize?response_type=code&client_id=" +
"52823f931877590c917b23f7" + "&redirect_uri=" + redirect_uri + "&state=" + dsuid + "&scope=read_station";
top.location.href=url;
}
var vdc_render_add_device = function(dsuid, connected)
{
var device = g_vdcs[dsuid];
......@@ -236,6 +240,7 @@ var vdc_render_add_device = function(dsuid, connected)
{
vdc_auth_button_clicked(dsuid, evt);
};
$("#btn_" + dsuid).click(callback);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment