fixed content-type for oauth
This commit is contained in:
parent
36e45d04ab
commit
3fff224924
4 changed files with 11 additions and 8 deletions
|
@ -142,7 +142,7 @@ function(HostApp, APICalls, Hmac) {
|
||||||
|
|
||||||
var requestBody = JSON.stringify({
|
var requestBody = JSON.stringify({
|
||||||
'code' : urlVars["code"],
|
'code' : urlVars["code"],
|
||||||
'token_type' : "https://tent.io/oauth/hawk-token"
|
'token_type': "https://tent.io/oauth/hawk-token"
|
||||||
});
|
});
|
||||||
|
|
||||||
var those = this;
|
var those = this;
|
||||||
|
@ -154,7 +154,7 @@ function(HostApp, APICalls, Hmac) {
|
||||||
);
|
);
|
||||||
|
|
||||||
APICalls.post(url, requestBody, {
|
APICalls.post(url, requestBody, {
|
||||||
content_type: "https://tent.io/types/app/v0#",
|
content_type: "application/json",
|
||||||
auth_header: auth_header,
|
auth_header: auth_header,
|
||||||
callback: function(resp) {
|
callback: function(resp) {
|
||||||
those.requestAccessTokenTicketFinished(resp.responseText);
|
those.requestAccessTokenTicketFinished(resp.responseText);
|
||||||
|
@ -170,7 +170,6 @@ function(HostApp, APICalls, Hmac) {
|
||||||
Oauth.prototype.requestAccessTokenTicketFinished = function(responseBody) {
|
Oauth.prototype.requestAccessTokenTicketFinished = function(responseBody) {
|
||||||
|
|
||||||
var access = JSON.parse(responseBody);
|
var access = JSON.parse(responseBody);
|
||||||
debug(access)
|
|
||||||
|
|
||||||
HostApp.setStringForKey(access["access_token"], "user_access_token");
|
HostApp.setStringForKey(access["access_token"], "user_access_token");
|
||||||
HostApp.setSecret(access["hawk_key"]);
|
HostApp.setSecret(access["hawk_key"]);
|
||||||
|
@ -178,7 +177,6 @@ function(HostApp, APICalls, Hmac) {
|
||||||
HostApp.setStringForKey(access["token_type"], "user_token_type");
|
HostApp.setStringForKey(access["token_type"], "user_token_type");
|
||||||
|
|
||||||
HostApp.loggedIn();
|
HostApp.loggedIn();
|
||||||
debug("loggedIn")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Oauth.prototype.logout = function() {
|
Oauth.prototype.logout = function() {
|
||||||
|
|
|
@ -240,7 +240,7 @@ function(HostApp, Core, APICalls, URI) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var url = HostApp.serverUrl("posts_feed") + "?types=" + encodeURIComponent("https://tent.io/types/meta/v0") + "&entities=" + encodeURIComponent(this.entity)
|
var url = HostApp.serverUrl("posts_feed") + "?types=" + encodeURIComponent("https://tent.io/types/meta/v0") + "&entities=" + encodeURIComponent(this.entity)
|
||||||
debug(url)
|
|
||||||
APICalls.get(url, {
|
APICalls.get(url, {
|
||||||
callback: function(resp) {
|
callback: function(resp) {
|
||||||
profile = JSON.parse(resp.responseText);
|
profile = JSON.parse(resp.responseText);
|
||||||
|
@ -272,7 +272,7 @@ function(HostApp, Core, APICalls, URI) {
|
||||||
|
|
||||||
Profile.prototype.showProfile = function(profile) {
|
Profile.prototype.showProfile = function(profile) {
|
||||||
|
|
||||||
debug(profile)
|
//debug(profile)
|
||||||
return
|
return
|
||||||
|
|
||||||
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
var basic = profile["https://tent.io/types/info/basic/v0.1.0"];
|
||||||
|
|
|
@ -36,7 +36,12 @@ function(jQuery, HostApp, Hmac, Cache) {
|
||||||
console.error("No content type for " + options.url);
|
console.error("No content type for " + options.url);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
if(options.content_type != "application/json") {
|
||||||
content_type = "application/vnd.tent.post.v0+json; type=\"" + options.content_type + "\"";
|
content_type = "application/vnd.tent.post.v0+json; type=\"" + options.content_type + "\"";
|
||||||
|
} else {
|
||||||
|
content_type = options.content_type;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = {
|
var settings = {
|
||||||
|
|
|
@ -65,7 +65,7 @@ function(jQuery, HostApp, Hmac, Cache) {
|
||||||
console.error("getURL (" + xhr.status + ")" + xhr.statusText + " " + http_method + " (" + url + "): '" + xhr.responseText + "'");
|
console.error("getURL (" + xhr.status + ")" + xhr.statusText + " " + http_method + " (" + url + "): '" + xhr.responseText + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug(url)
|
|
||||||
jQuery.ajax(options);
|
jQuery.ajax(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue