• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java OAuthGetTemporaryToken类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.api.client.auth.oauth.OAuthGetTemporaryToken的典型用法代码示例。如果您正苦于以下问题:Java OAuthGetTemporaryToken类的具体用法?Java OAuthGetTemporaryToken怎么用?Java OAuthGetTemporaryToken使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OAuthGetTemporaryToken类属于com.google.api.client.auth.oauth包,在下文中一共展示了OAuthGetTemporaryToken类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTempToken

import com.google.api.client.auth.oauth.OAuthGetTemporaryToken; //导入依赖的package包/类
public String getTempToken() throws IOException {

		// Step 1: Get a request token. This is a temporary token that is used for
		// having the user authorize an access token and to sign the request to obtain
		// said access token.
		OAuthGetTemporaryToken requestTempToken = new OAuthGetTemporaryToken(REQUEST_TOKEN_URL);
		requestTempToken.consumerKey = CONSUMER_KEY;
		requestTempToken.transport = http_transport;
		requestTempToken.signer = signer;

		OAuthCredentialsResponse requestTokenResponse = requestTempToken.execute();
		Log.d("Philip", "Request Temp Token:");
		Log.d("Philip", "    - oauth_token        = " + requestTokenResponse.token);
		Log.d("Philip", "    - oauth_token_secret = " + requestTokenResponse.tokenSecret);

		// updates signer's token shared secret
		signer.tokenSharedSecret = requestTokenResponse.tokenSecret;

		return requestTokenResponse.token;
	}
 
开发者ID:phwoelfel,项目名称:FireHydrantLocator,代码行数:21,代码来源:OAuthTokenmanager.java


示例2: execute

import com.google.api.client.auth.oauth.OAuthGetTemporaryToken; //导入依赖的package包/类
public void execute() {
  OAuthSigner signer = signerFactory.createSigner(null);

  tokenRequest = new OAuthGetTemporaryToken(config.getRequestTokenUrl());
  tokenRequest.consumerKey = config.getConsumerKey();
  tokenRequest.callback = config.getRedirectUri();

  ApacheHttpTransport.Builder transBuilder = new ApacheHttpTransport.Builder();
  if (config.getProxyHost() != null && "" != config.getProxyHost()) {
    String proxy_host = config.getProxyHost();
    long proxy_port = config.getProxyPort();
    boolean proxyHttps = config.getProxyHttpsEnabled();
    String proxy_schema = proxyHttps == true ? "https" : "http";
    System.out.println("proxy.host=" + proxy_host + ", proxy.port=" + proxy_port + ", proxy_schema=" + proxy_schema);
    HttpHost proxy = new HttpHost(proxy_host, (int) proxy_port, proxy_schema);
    transBuilder.setProxy(proxy);
    tokenRequest.transport = transBuilder.build();
  } else {
    tokenRequest.transport = new ApacheHttpTransport();
  }

  tokenRequest.signer = signer;

  OAuthCredentialsResponse temporaryTokenResponse = null;
  try {
    temporaryTokenResponse = tokenRequest.execute();

    tempToken = temporaryTokenResponse.token;
    tempTokenSecret = temporaryTokenResponse.tokenSecret;
  } catch (IOException e) {
    e.printStackTrace();
  }
}
 
开发者ID:XeroAPI,项目名称:Xero-Java,代码行数:34,代码来源:OAuthRequestToken.java


示例3: doInBackground

import com.google.api.client.auth.oauth.OAuthGetTemporaryToken; //导入依赖的package包/类
@Override
protected Void doInBackground(Uri... params) {

    try {

        signer.clientSharedSecret = Constants.CONSUMER_SECRET;

        OAuthGetTemporaryToken temporaryToken = new OAuthGetTemporaryToken(Constants.REQUEST_URL);
        temporaryToken.transport = new ApacheHttpTransport();
        temporaryToken.signer = signer;
        temporaryToken.consumerKey = Constants.CONSUMER_KEY;
        temporaryToken.callback = Constants.OAUTH_CALLBACK_URL;

        OAuthCredentialsResponse tempCredentials = temporaryToken.execute();
        signer.tokenSharedSecret = tempCredentials.tokenSecret;

        OAuthAuthorizeTemporaryTokenUrl authorizeUrl = new OAuthAuthorizeTemporaryTokenUrl(Constants.AUTHORIZE_URL);
        authorizeUrl.temporaryToken = tempCredentials.token;
        authorizationUrl = authorizeUrl.build();

        handled = false;
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    return null;
}
 
开发者ID:ipragmatech,项目名称:OAuth-Magento-Rest-Api-Retrofit,代码行数:28,代码来源:WebActivity.java


示例4: new10aTemporaryTokenRequest

import com.google.api.client.auth.oauth.OAuthGetTemporaryToken; //导入依赖的package包/类
/**
 * Returns the response of a Request Token request as defined in <a
 * href="http://oauth.net/core/1.0a/#auth_step1">Obtaining an Unauthorized
 * Request Token</a>.
 * 
 * @param redirectUri the {@code oauth_callback} as defined in <a
 *            href="http://oauth.net/core/1.0a/#rfc.section.6.1.1">Consumer
 *            Obtains a Request Token</a>
 * @return
 * @throws IOException
 */
public OAuthCredentialsResponse new10aTemporaryTokenRequest(String redirectUri)
        throws IOException {
    OAuthGetTemporaryToken temporaryToken =
            new OAuthGetTemporaryToken(getTemporaryTokenRequestUrl());
    OAuthHmacSigner signer = new OAuthHmacSigner();
    ClientParametersAuthentication clientAuthentication = (ClientParametersAuthentication) getClientAuthentication();
    signer.clientSharedSecret = clientAuthentication.getClientSecret();
    temporaryToken.signer = signer;
    temporaryToken.consumerKey = clientAuthentication.getClientId();
    temporaryToken.callback = redirectUri;
    temporaryToken.transport = getTransport();
    return temporaryToken.execute();
}
 
开发者ID:agilie,项目名称:dribbble-android-sdk,代码行数:25,代码来源:AuthorizationFlow.java



注:本文中的com.google.api.client.auth.oauth.OAuthGetTemporaryToken类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XSDeclaration类代码示例发布时间:2022-05-23
下一篇:
Java Organization类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap