com.twitter.sdk.android.core.identity.TwitterAuthClient Java Examples

The following examples show how to use com.twitter.sdk.android.core.identity.TwitterAuthClient. 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: TwitterNetwork.java    From EasyLogin with MIT License 6 votes vote down vote up
private void requestEmail(final TwitterSession session, final AccessToken tempToken) {
    TwitterAuthClient authClient = new TwitterAuthClient();
    authClient.requestEmail(session, new Callback<String>() {
        @Override
        public void success(Result<String> result) {
            final String email = result.data;
            if (TextUtils.isEmpty(email)) {
                logout();
                callLoginFailure("Before fetching an email, ensure that 'Request email addresses from users' is checked for your Twitter app.");
                return;
            }
            accessToken = new AccessToken.Builder(tempToken).email(email).build();
            callLoginSuccess();
        }

        @Override
        public void failure(TwitterException exception) {
            Log.e("TwitterNetwork", "Before fetching an email, ensure that 'Request email addresses from users' is checked for your Twitter app.");
            callLoginFailure(exception.getMessage());
        }
    });
}
 
Example #2
Source File: TwitterLoginInstance.java    From ShareLoginPayUtil with Apache License 2.0 5 votes vote down vote up
public TwitterLoginInstance(Activity activity, final LoginListener listener,
                            final boolean fetchUserInfo) {
    super(activity, listener, fetchUserInfo);

    TwitterConfig config = new TwitterConfig.Builder(activity)
            .logger(new DefaultLogger(Log.DEBUG))
            .twitterAuthConfig(new TwitterAuthConfig(ShareManager.CONFIG.getTwitterConsumerKey(),
                    ShareManager.CONFIG.getTwitterConsumerSecret()))
            .debug(BuildConfig.DEBUG).build();

    Twitter.initialize(config);
    mTwitterAuthClient = new TwitterAuthClient();
}
 
Example #3
Source File: TwitterHelper.java    From social-login-helper-Deprecated- with MIT License 5 votes vote down vote up
public TwitterHelper(@NonNull TwitterListener response, @NonNull Activity context,
    @NonNull String twitterApiKey, @NonNull String twitterSecreteKey) {
  mActivity = context;
  mListener = response;
  mTwitterApiKey = twitterApiKey;
  mTwitterSecreteKey = twitterSecreteKey;
  mAuthClient = new TwitterAuthClient();
}
 
Example #4
Source File: FragmentProfile.java    From uPods-android with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mTwitterAuthClient = new TwitterAuthClient();
    ((IToolbarHolder) getActivity()).getToolbar().setVisibility(View.GONE);

    rootView = inflater.inflate(R.layout.fragment_profile, container, false);
    loginManager = (ILoginManager) getActivity();
    lnLoggedInState = (LinearLayout) rootView.findViewById(R.id.lnLoggedInState);
    lnLoggedOutState = (LinearLayout) rootView.findViewById(R.id.lnLoggedOutState);
    progressBar = (ProgressBar) rootView.findViewById(R.id.pbLoading);

    progressBar.setVisibility(View.GONE);

    rootView.findViewById(R.id.btnVklogin).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            VKSdk.login(FragmentProfile.this, VK_SCOPE);
        }
    });

    if (LoginMaster.getInstance().isLogedIn()) {
        lnLoggedOutState.setVisibility(View.GONE);
        lnLoggedInState.setVisibility(View.VISIBLE);
        initUserProfileUI();
    } else {
        initLoginUI(rootView);
    }
    return rootView;
}
 
Example #5
Source File: TwitterCoreMainActivity.java    From twitter-kit-android with Apache License 2.0 5 votes vote down vote up
private static void requestEmailAddress(final Context context, TwitterSession session) {
    new TwitterAuthClient().requestEmail(session, new Callback<String>() {
        @Override
        public void success(Result<String> result) {
            Toast.makeText(context, result.data, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void failure(TwitterException exception) {
            Toast.makeText(context, exception.getMessage(), Toast.LENGTH_SHORT).show();
        }
    });
}
 
Example #6
Source File: TwitterApiManager.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public TwitterAuthClient getTwitterAuthClient() {
    if (this.authClient == null) {
        this.authClient = new TwitterAuthClient();
    }
    return this.authClient;
}