com.linecorp.linesdk.auth.LineLoginApi Java Examples
The following examples show how to use
com.linecorp.linesdk.auth.LineLoginApi.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SignInFragment.java From line-sdk-android with Apache License 2.0 | 6 votes |
@OnClick(R.id.sign_in_btn) @SuppressWarnings("unused") public void onSignInBtnClick() { try { Intent intent = LineLoginApi.getLoginIntent( getContext(), createLineAuthenticationConfigForTest(), createAuthenticationParamsForTest()); startActivityForResult(intent, REQUEST_CODE); addLog("Sign-in is started. [" + LOG_SEPARATOR + " channelId : " + channelId + LOG_SEPARATOR + "]"); } catch (Exception e) { addLog(e.toString()); } }
Example #2
Source File: LoginHandler.java From line-sdk-android with Apache License 2.0 | 6 votes |
boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (!isLoginRequestCode(requestCode)) { Log.w(TAG, "Unexpected login request code"); return false; } if (isLoginCanceled(resultCode, data)) { Log.w(TAG, "Login failed"); return false; } LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data); if (isLoginSuccess(result)) { onLoginSuccess(result); } else { onLoginFailure(result); } return true; }
Example #3
Source File: LineSDKUITestingActivity.java From line-sdk-android with Apache License 2.0 | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode != REQUEST_CODE_LINE_SIGN_IN) { return; } LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data); Log.i("LineSDKUITesting", result.toString()); if (activityActionDelegate != null) { activityActionDelegate.onActivityResult(requestCode, resultCode, data); } }
Example #4
Source File: SignInFragment.java From line-sdk-android with Apache License 2.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data); addLog("===== Login result ====="); addLog(result.toString()); addLog("=========================="); } else { addLog("Illegal response : onActivityResult(" + requestCode + ", " + resultCode + ", " + data + ")"); } }
Example #5
Source File: LoginHandler.java From line-sdk-android with Apache License 2.0 | 5 votes |
@NonNull private Intent getLoginIntent( @NonNull Activity activity, boolean isLineAppAuthEnabled, @NonNull String channelId, @NonNull LineAuthenticationParams params ) { Intent intent; if (isLineAppAuthEnabled) { intent = LineLoginApi.getLoginIntent(activity, channelId, params); } else { intent = LineLoginApi.getLoginIntentWithoutLineAppAuth(activity, channelId, params); } return intent; }
Example #6
Source File: LineLogin.java From cordova-line-login-plugin with Apache License 2.0 | 5 votes |
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode != REQUEST_CODE) { return; } LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data); if (result.getResponseCode() == LineApiResponseCode.SUCCESS) { JSONObject json = new JSONObject(); try { LineProfile profile = result.getLineProfile(); json.put("userID", profile.getUserId()); json.put("displayName", profile.getDisplayName()); if (profile.getPictureUrl() != null) { json.put("pictureURL", profile.getPictureUrl().toString()); } LineIdToken lineIdToken = result.getLineIdToken(); json.put("email", lineIdToken.getEmail()); callbackContext.success(json); } catch (JSONException e) { this.UnknownError(e.toString()); } } else if (result.getResponseCode() == LineApiResponseCode.CANCEL) { this.SDKError(result.getResponseCode().toString(), "user cancel"); } else { this.SDKError(result.getResponseCode().toString(), result.toString()); } }
Example #7
Source File: LineLogin.java From cordova-line-login-plugin with Apache License 2.0 | 5 votes |
private void login(CallbackContext callbackContext) { try { Intent loginIntent = LineLoginApi.getLoginIntent( this.cordova.getActivity().getApplicationContext(), channelId, new LineAuthenticationParams.Builder() .scopes(Arrays.asList(Scope.PROFILE, Scope.OPENID_CONNECT, Scope.OC_EMAIL)) .build() ); this.cordova.startActivityForResult((CordovaPlugin) this, loginIntent, REQUEST_CODE); } catch (Exception e) { this.UnknownError(e.toString()); } }
Example #8
Source File: MainActivity.java From line-sdk-starter-android-v2 with MIT License | 5 votes |
public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode != REQUEST_CODE) { Log.e("ERROR", "Unsupported Request"); return; } LineLoginResult result = LineLoginApi.getLoginResultFromIntent(data); switch (result.getResponseCode()) { case SUCCESS: Intent transitionIntent = new Intent(this, PostLoginActivity.class); transitionIntent.putExtra("line_profile", result.getLineProfile()); transitionIntent.putExtra("line_credential", result.getLineCredential()); startActivity(transitionIntent); break; case CANCEL: Log.e("ERROR", "LINE Login Canceled by user!!"); break; default: Log.e("ERROR", "Login FAILED!"); Log.e("ERROR", result.getErrorData().toString()); } }