Hi Dennis,
I am trying to get all product with catalogs but I am getting " Access token is missing or invalid." error. I tried to invalidateAccessToken to get the new token as well but still it is giving the same error.
` private IPoyntSessionServiceListener sessionServiceListener = new IPoyntSessionServiceListener.Stub() {
@Override
public void onResponse(final Account account, PoyntError poyntError) throws RemoteException {
runOnUiThread(new Runnable() {
@Override
public void run() {
if(account == null) {
accountManager.getAuthToken(Constants.Accounts.POYNT_UNKNOWN_ACCOUNT,
Constants.Accounts.POYNT_AUTH_TOKEN, null, SplashActivity.this,
new OnTokenAcquired(), null);
} else {
currentAccount = account;
AccountManagerFuture<Bundle> result = accountManager.getAuthToken(currentAccount, Constants.Accounts.POYNT_AUTH_TOKEN,
null, SplashActivity.this, null, null);
try {
Bundle bundle = result.getResult();
accessToken = bundle
.getString(AccountManager.KEY_AUTHTOKEN);
new RetrieveTokenTask().execute();
} catch (Exception e) {
}
}
}
});
}
};
private class RetrieveTokenTask extends AsyncTask<Void, Void, String> {
@Override
protected Void doInBackground(Void... params) {
try {
accountManager.invalidateAuthToken(currentAccount.type, accessToken);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
@Override
protected void onPostExecute(Void s) {
super.onPostExecute(s);
accountManager.getAuthToken(currentAccount, Constants.Accounts.POYNT_AUTH_TOKEN,
null, SplashActivity.this, new OnTokenAcquired(), null);
}
}
public class OnTokenAcquired implements AccountManagerCallback<Bundle> {
@Override
public void run(AccountManagerFuture<Bundle> result) {
try {
Bundle bundle = result.getResult();
Intent launch = (Intent) bundle.get(AccountManager.KEY_INTENT);
if (launch != null) {
Log.d("TransactionTestActivity", "received intent to login");
startActivityForResult(launch, AUTHORIZATION_CODE);
} else {
Log.d("TransactionTestActivity", "token user:" + bundle.get(AccountManager.KEY_ACCOUNT_NAME));
accessToken = bundle
.getString(AccountManager.KEY_AUTHTOKEN);
Log.d("TransactionTestActivity", "received token result: " + accessToken);
Intent intent = new Intent(SplashActivity.this,NavigationActivity.class);
startActivity(intent);
finish();
}
} catch (Exception e) {
Log.d("TransactionTestActivity", "Exception received: " + e.getMessage());
}
}
}`
What mistake I am doing here?
Best
Sandeep