1
import Ubuntu.OnlineAccounts.Plugin 1.0
4
creationComponent: OAuth {
5
authenticationParameters: {
6
"AuthPath": "login/oauth/authorize"
9
function completeCreation(reply) {
10
console.log("Access token: " + reply.AccessToken)
11
var http = new XMLHttpRequest()
12
var url = "https://www.github.com/user";
13
http.open("POST", url, true);
14
http.setRequestHeader("Authorization", "Bearer " + reply.AccessToken)
15
http.onreadystatechange = function() {
16
if (http.readyState === 4){
17
if (http.status == 200) {
19
console.log("response text: " + http.responseText)
20
var response = JSON.parse(http.responseText)
21
account.updateDisplayName(response.login)
22
account.synced.connect(finished)
26
console.log("error: " + http.status)