question

James Pfluger avatar image
James Pfluger asked ·

ERROR_DATA_STORAGE -- Unable to insert com.amazon.identity.token.accessToken token into db (

Howdy y'all,


I am trying to implement LWA within my Android app. I am using the LWA SDK (latest version I believe). I have successfully been able to create a login button that performs a request which I know because I no longer get an INVALID API error.


However, now I am receiving an error about being unable to insert an item into the database.
There are errors about illegal block sizes for encryption and errors about being unable to insert into the database.
I have created a Security Profile and use the API key I received from generating the MD5 and SHA256 hashes from my APK.


Any help is appreciated.


Note that this ONLY occurs on my HTC U11 (Android 8.0.0) and not on my Galaxy S5 (Android L)

Here is the FULL logcat exception I receive:

logcagt.txt


Here is the code in my class (barebones):

public class LoginActivity extends Activity {
    private RequestContext requestContext;
    private View mloginButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestContext = RequestContext.create(getApplicationContext());

        requestContext.registerListener(new AuthorizeListener() {
            /* Authorization was completed successfully. */
            @Override
            public void onSuccess(AuthorizeResult authorizeResult) {
                Log.e("AWS", "Auth success");
            }

            /* There was an error during the attempt to authorize the application */
            @Override
            public void onError(AuthError authError) {
                Log.e("AWS", "AuthError during authorization", authError);
            }

            /* Authorization was cancelled before it could be completed. */
            @Override
            public void onCancel(AuthCancellation authCancellation) {
                Log.e("AWS", "User cancelled authorization");
            }
        });

        setContentView(R.layout.activity_login);
        mloginButton = findViewById(R.id.loginButton);
        mloginButton.setOnClickListener(new View.OnClickListener() {
                                           @Override
                                           public void onClick(View v) {
                                               AuthorizationManager.authorize(new AuthorizeRequest
                                                       .Builder(requestContext)
                                                       .addScopes(ProfileScope.profile(), ProfileScope.postalCode())
                                                       .build());
                                                }
                                            }
                                        );
    }

    @Override
    protected void onResume() {
        super.onResume();
        requestContext.onResume();
    }
}
login with amazonandroidsdk
logcagt.txt (30.3 KiB)
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

James Pfluger avatar image
James Pfluger answered ·

Ok I figured it out! The problem was that a record seemed to already exist in a local SQLite database on my phone. Somehow some data was being persisted in this database, which was causing problems.


The FIX was to modify the following line in my AndroidMainifest.XML:


android:allowBackup="true"


which had to be changed to be false:

android:allowBackup="false"
1 comment
10 |2000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Does anyone know how to allowBackup but exclude the token being saved?

0 Likes 0 ·