James Pfluger avatar image
James Pfluger asked

ERROR_DATA_STORAGE -- Unable to insert 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:


Here is the code in my class (barebones):

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

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

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

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

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

        mloginButton = findViewById(;
        mloginButton.setOnClickListener(new View.OnClickListener() {
                                           public void onClick(View v) {
                                               AuthorizationManager.authorize(new AuthorizeRequest
                                                       .addScopes(ProfileScope.profile(), ProfileScope.postalCode())

    protected void onResume() {
login with amazonandroidsdk
logcagt.txt (30.3 KiB)
10 |5000

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:


which had to be changed to be false:

1 comment
10 |5000

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 ·