2014-06-29 27 views
1

我想在android eclipse應用程序中根據https://oauth.io/docs/api使用OAuth。不能使用緩存:真正與OAuth.initialize

import io.oauth.*; 
..... 
final OAuth o = new OAuth(this); 
o.initialize(KEY); 

工作正常。

不過,我想使用,以免每次登錄緩存功能,所以我儘量

o.initialize(KEY, {cache: true}); 

不幸的是這不會編譯。我得到

"Multiple markers at this line 
    -Syntax error on tokens, delete these tokens 
    -Syntax error on token(s), misplaced construct(s)" 

正如你可以告訴我是一個android和Eclipse新手,任何幫助表示讚賞。

回答

0

公鑰是用於初始化方法的唯一參數。 接受緩存對象作爲參數的正確方法是彈出式窗口。

實施例:

OAuth.initialize('x9x9x9x9x9'); //OAuth.io public key 
 

 
var promise = OAuth.popup('google_mail', {cache: true}); 
 

 
promise.done(function (result) { 
 
    // make API calls 
 
}); 
 

 
promise.fail(function (error) { 
 
    // handle errors 
 
});