Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm working on a web app that includes a file export to Dropbox and Skydrive and i wanted to add UbuntuOne, too. That means i need access to files and if i understand the U1 API docs correctly the only oauth token with access to files is full access token:

https://one.ubuntu.com/developer/account_admin/issue_tokens/cloud

But requesting a full access token requires the user to type in his username and password into my app, is that correct? Or is there another way to get a request a token with access to the user's files the same way a limited access token is requested, i.e. the user doesn't have to provide his username and password to my app?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

There is. As a web app, you may use the standard OAuth dance against Ubuntu One to obtain an OAuth token.

Use URLs https://one.ubuntu.com/oauth/request to get a token, redirect the user to https://one.ubuntu.com/oauth/authorize/?description=yourappname to have it authorized, and https://one.ubuntu.com/oauth/access/ to convert it to a real token which you can save and use to authenticate requests on the user's behalf.

share|improve this answer
    
also, I'm happy to provide additional information and help if required; just drop me a line or chase me down on freenode IRC (as aquarius). –  sil Mar 14 '12 at 10:50
    
Thanks! This looks much like requesting a limited access token but without the app subfolder. Is this documented somewhere? If i try this with PHP OAuth it throws an exception, saying that most likely my consumerToken/Secret are incorrect. Do i have to use u1app, as in the limited access tokens or do i have to request unique tokens? If so, where can i get a consumerToken/Secret? –  migerh Mar 14 '12 at 13:41
    
To clarify, for these tokens, use ubuntuone/hammertime as the consumer details. –  sil Mar 15 '12 at 22:11
    
@sil your first link (one.ubuntu.com/oauth/request) returns 404 –  Lucio Mar 15 at 23:11

This should work: http://pastebin.ubuntu.com/883106/

There's some example code in a library I wrote that goes through these steps: https://code.launchpad.net/restful-u1

share|improve this answer
    
This looks like it's using the Ubuntu SSO where my app needs the user's username and password which is what i'm trying to avoid. –  migerh Mar 14 '12 at 13:45
    
No, this is how you get an access token the first time. Once you have the access token you can use it by signing the requests with the consumer/token pair as shown in the example. –  webm0nk3y Mar 14 '12 at 19:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.