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


Java AuthorizeResult类代码示例

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


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

示例1: onSuccess

import com.amazon.identity.auth.device.api.authorization.AuthorizeResult; //导入依赖的package包/类
@Override
public void onSuccess(final AuthorizeResult authorizeResult) {
    final String authorizationCode = authorizeResult.getAuthorizationCode();
    final String redirectUri = authorizeResult.getRedirectURI();
    final String clientId = authorizeResult.getClientId();
    CLIENTID = clientId;

            SharedPreferences.Editor  preferences = Util.getPrefernces(myContext).edit();
            preferences.putString("clientID",clientId);
            preferences.apply();
            RequestBody formBody = new FormBody.Builder()
                    .add("grant_type", "authorization_code")
                    .add("code", authorizationCode)
                    .add("redirect_uri", redirectUri)
                    .add("client_id", clientId)
                    .add("code_verifier", codeVerifier)
                    .build();

            tokenHanlder.doPostRequest(formBody,TokenHandler.FirstMainActivityDoPostRequest);

}
 
开发者ID:raj10071997,项目名称:Alexa-Voice-Service,代码行数:22,代码来源:MainActivity.java

示例2: onStart

import com.amazon.identity.auth.device.api.authorization.AuthorizeResult; //导入依赖的package包/类
@Override
protected void onStart() {
    super.onStart();
    Scope[] scopes = {ProfileScope.profile(), ProfileScope.postalCode()};
    AuthorizationManager.getToken(this, scopes, new Listener<AuthorizeResult, AuthError>() {
        @Override
        public void onSuccess(AuthorizeResult result) {
            if (result.getAccessToken() != null) {
                /* The user is signed in */
                fetchUserProfile();
            } else {
                /* The user is not signed in */
            }
        }

        @Override
        public void onError(AuthError ae) {
            /* The user is not signed in */
        }
    });
}
 
开发者ID:dazcode,项目名称:smart-device-cloud,代码行数:22,代码来源:LoginWithAmazonActivity.java

示例3: onCreate

import com.amazon.identity.auth.device.api.authorization.AuthorizeResult; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);


    requestContext = RequestContext.create(this);
    requestContext.registerListener(new AuthorizeListener() {

        @Override
        public void onSuccess(AuthorizeResult authorizeResult) {
            runOnUiThread(new Runnable() {
                @Override
                public void run() {

                    setLoggingInState(true);
                }
            });
            fetchUserProfile();
        }


        @Override
        public void onError(AuthError authError) {
            Log.e(TAG, "AuthError during authorization", authError);
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    utilities.showToast("Error during authorization.  Please try again.", getApplicationContext());
                    resetProfileView();
                    setLoggingInState(false);
                }
            });
        }


        @Override
        public void onCancel(AuthCancellation authCancellation) {
            Log.e(TAG, "User cancelled authorization");
            runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    utilities.showToast("Authorization cancelled.", getApplicationContext());
                    resetProfileView();
                }
            });
        }
    });

    setContentView(R.layout.login_with_amazon);

    initializeUI();
}
 
开发者ID:dazcode,项目名称:smart-device-cloud,代码行数:53,代码来源:LoginWithAmazonActivity.java


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