SSO token name must have spaces around "@"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ubuntu One Developer Website |
New
|
Undecided
|
Unassigned |
Bug Description
I'm trying to connect to Ubuntu One from YQL to get Ubuntu One data as YQL table.
This requires to generate with Javascript the XML as outlined in http://
The only implementation in JS I found is on maemo.org for a QT client (http://
There implementation of API authentication/
Basically the code should:
1) Create a new token in Ubuntu SSO (login.ubuntu.com).
2) Tell Ubuntu One about that new token.
3) Use that new token to sign a request to the Ubuntu One files API.
The code for the YQL is on github (https:/
<code>
// Include the OAuth libraries from oauth.net
y.include("http://
y.include("http://
function getToken(user, pass, token_name) {
var url = "https:/
var uri = url + "?ws.op=
var header_auth = 'Basic ' + y.crypto.
// Get authentication
var resp = y.rest(
// cast to string
var secrets = {
consumerKey: String(
consumerSecret: String(
token: String(resp.token),
tokenSecret: String(
};
return secrets;
}
function registerToken(
var url = "https:/
reg = oAuthRequest(url, secrets);
return reg;
}
function oAuthRequest(url, secrets, method, range) {
if(!method) method = "GET";
var message = {
action: url,
method: method,
parameters: [
[
[
[
]
};
OAuth.
OAuth.
var auth = OAuth.getAuthor
return = y.rest(
}
// Main
var OAuth;
var token_name = "Ubuntu One @test";
// 1 ) Get the token using HTML authentication
var secrets = getToken(email, pwd, token_name); // works
// 2) Register the token
var reg = registerToken(
// 3) Use API
var APIurl = "https:/
resp = oAuthRequest(
</code>
Steps 1) and 2) seems ok but 3) still return "Invalid access token". The result from step 2 reads:
<log>oAuthRequest - url: https://<email address hidden></log>
<url execution-
<log>oAuthRequest (https://<email address hidden>) - resp: </log>
<log>ok 0/1
</log>
So everything seems fine, but:
<log>oAuthRequest - url: https:/
<url execution-
<log>oAuthRequest (https:/
<log>Invalid access token: PZvMjSewNiphQkD
</log>
I'm not sure if the issue is related to YQL but given the log doesn't seems so.
description: | updated |
The 0/1 from sso-finished- so-get- token means that it found 0 valid tokens. The issue was that the token name needs to be "Ubuntu One @ something" with spaces around the "@".