0

I have some code and its work to login or logout ,but I want to get access_tonken and store it in database.

my code:

private void onTwitterClick() {

    if (mTwitter.hasAccessToken()) {
        final AlertDialog.Builder builder = new AlertDialog.Builder(this);

        builder.setMessage("Delete current Twitter connection?").setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                mTwitter.resetAccessToken();
                mTwitterBtn.setChecked(false);
                mTwitterBtn.setText("  Twitter (Not connected)");
                mTwitterBtn.setTextColor(Color.GRAY);
            }
        })
        .setNegativeButton("No", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.cancel();

                mTwitterBtn.setChecked(true);
            }
        });
        final AlertDialog alert = builder.create();
        alert.show();
    } else {
        mTwitterBtn.setChecked(false);
        mTwitter.authorize();   
        // mTwitter.processToken(callbackUrl);        
    }
}

How to get access_token ?? any solution??

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
Lia
  • 57
  • 8

1 Answers1

0

The access token return to your "callbackUrl" and lives short period of session time. You can not store it in your database.

Yahor10
  • 2,123
  • 1
  • 13
  • 13