当前位置: 首页>>代码示例>>Java>>正文


Java AndroidAuthSession.setOAuth2AccessToken方法代码示例

本文整理汇总了Java中com.dropbox.client2.android.AndroidAuthSession.setOAuth2AccessToken方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidAuthSession.setOAuth2AccessToken方法的具体用法?Java AndroidAuthSession.setOAuth2AccessToken怎么用?Java AndroidAuthSession.setOAuth2AccessToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.dropbox.client2.android.AndroidAuthSession的用法示例。


在下文中一共展示了AndroidAuthSession.setOAuth2AccessToken方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadAuth

import com.dropbox.client2.android.AndroidAuthSession; //导入方法依赖的package包/类
protected void loadAuth(AndroidAuthSession session) {
    SharedPreferences prefs = PreferenceManager
            .getDefaultSharedPreferences(mContext);
    String key = prefs.getString(ACCESS_KEY_NAME, null);
    String secret = prefs.getString(ACCESS_SECRET_NAME, null);

    if (key == null || secret == null || key.length() == 0
            || secret.length() == 0)
        return;

    if (key.equals("oauth2:")) {
        // If the key is set to "oauth2:", then we can assume the token is
        // for OAuth 2.
        session.setOAuth2AccessToken(secret);
    } else {
        // Still support using old OAuth 1 tokens.
        session.setAccessTokenPair(new AccessTokenPair(key, secret));
    }
}
 
开发者ID:sysnetlab,项目名称:SensorDataCollector,代码行数:20,代码来源:DropboxHelper.java

示例2: loadAuth

import com.dropbox.client2.android.AndroidAuthSession; //导入方法依赖的package包/类
private void loadAuth(AndroidAuthSession session) {
    SharedPreferences prefs = mContext.getSharedPreferences(ACCOUNT_PREFS_NAME, 0);
    String key = prefs.getString(ACCESS_KEY_NAME, null);
    String secret = prefs.getString(ACCESS_SECRET_NAME, null);
    if (key == null || secret == null || key.length() == 0 || secret.length() == 0)
    {
        Log.d(TAG,"No key found");
        return;
    }

    if (key.equals("oauth2:")) {
        // If the key is set to "oauth2:", then we can assume the token is for OAuth 2.
        Log.d(TAG,"OAuth 2 token found");
        session.setOAuth2AccessToken(secret);
    } else {
        // Still support using old OAuth 1 tokens.
        Log.d(TAG,"OAuth 1 keypair found");
        session.setAccessTokenPair(new AccessTokenPair(key, secret));
    }
}
 
开发者ID:bright-tools,项目名称:androidphotobackup,代码行数:21,代码来源:DropBoxWrapper.java

示例3: loadAuth

import com.dropbox.client2.android.AndroidAuthSession; //导入方法依赖的package包/类
private void loadAuth(AndroidAuthSession session) {
    SharedPreferences prefs = getSharedPreferences(ACCOUNT_PREFS_NAME, 0);
    String key = prefs.getString(ACCESS_KEY_NAME, null);
    String secret = prefs.getString(ACCESS_SECRET_NAME, null);
    if (key == null || secret == null || key.length() == 0 || secret.length() == 0) {
        return;
    }

    session.setOAuth2AccessToken(secret);
}
 
开发者ID:owoc,项目名称:teardrop,代码行数:11,代码来源:LibraryActivity.java

示例4: loadAuth

import com.dropbox.client2.android.AndroidAuthSession; //导入方法依赖的package包/类
/**
 * Shows keeping the access keys returned from Trusted Authenticator in a local
 * store, rather than storing user name & password, and re-authenticating each
 * time (which is not to be done, ever).
 */
private void loadAuth(AndroidAuthSession session) {
  SharedPreferences prefs = activity.getSharedPreferences("ACCOUNT_PREFS_NAME", 0);
  String key = prefs.getString(DROPBOX_PREFKEY_NAME, null);
  String secret = prefs.getString(DROPBOX_PREFKEY_SECRET, null);
  if (key == null || secret == null || key.length() == 0 || secret.length() == 0) return;

  if (key.equals("oauth2:")) {
    // If the key is set to "oauth2:", then we can assume the token is for OAuth 2.
    session.setOAuth2AccessToken(secret);
  } else {
    // Still support using old OAuth 1 tokens.
    session.setAccessTokenPair(new AccessTokenPair(key, secret));
  }
}
 
开发者ID:carlosmuvi,项目名称:clean-ebook-library,代码行数:20,代码来源:DropboxDatasource.java


注:本文中的com.dropbox.client2.android.AndroidAuthSession.setOAuth2AccessToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。