/usr/share/accounts/qml-plugins/google/Main.qml is in account-plugin-google 0.11+14.04.20140409.1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | import Ubuntu.OnlineAccounts.Plugin 1.0
OAuthMain {
creationComponent: OAuth {
authenticationParameters: {
"AuthPath": "o/oauth2/auth?access_type=offline&approval_prompt=force"
}
function completeCreation(reply) {
console.log("Access token: " + reply.AccessToken)
var http = new XMLHttpRequest()
var url = "https://www.googleapis.com/oauth2/v3/userinfo";
http.open("POST", url, true);
http.setRequestHeader("Authorization", "Bearer " + reply.AccessToken)
http.onreadystatechange = function() {
if (http.readyState === 4){
if (http.status == 200) {
console.log("ok")
console.log("response text: " + http.responseText)
var response = JSON.parse(http.responseText)
account.updateDisplayName(response.email)
account.synced.connect(finished)
account.sync()
} else {
console.log("error: " + http.status)
cancel()
}
}
};
http.send(null);
}
}
}
|