Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jackson error on custom token #177

Open
mfitzwm8 opened this issue Oct 7, 2019 · 0 comments
Open

Jackson error on custom token #177

mfitzwm8 opened this issue Oct 7, 2019 · 0 comments

Comments

@mfitzwm8
Copy link

mfitzwm8 commented Oct 7, 2019

I get the following error when trying to login using a custom token containing an array:

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String out of START_ARRAY token at [Source: (okio.RealBufferedSource$1); line: 1, column: 212] (through reference chain: com.mongodb.stitch.core.auth.internal.models.ApiCoreUserProfile["data"]->java.util.LinkedHashMap["accountIds"])

I get a similar Jackson error if I use a nested object within the user_data property. If I revert these to simple strings etc then it succeeds.

Version: 4.5.0

JWT payload:

{ "aud": "<app_id>", "sub": "<user_id>", "iat": 1570452225, "exp": 1570458825, "user_data": { "accountIds": [ "<id_1>", "<id_2>" ] } }

Code to reproduce is based on the Sample Todo List repo with the following addition in LogonActivity.java:

private void enableCustomAuth() {
    String token = "<jwt_token>";
    findViewById(R.id.custom_login_button).setOnClickListener(ignored ->
            TodoListActivity.client.getAuth().loginWithCredential(new CustomCredential(token))
                    .addOnSuccessListener(user -> {
                        Toast.makeText(LogonActivity.this,
                                "Logged in Custom. ID: " + user.getId(),
                                Toast.LENGTH_LONG).show();
                        setResult(Activity.RESULT_OK);
                        finish();
                    })
                    .addOnFailureListener(e -> {
                        Log.d("Stitch Auth", "error logging in", e);
                        Toast.makeText(LogonActivity.this, "Failed to log in Anonymously. " +
                                        "Did you enable Anonymous Auth in your Stitch backend and copy " +
                                        "your Stitch App ID to strings.xml?",
                                Toast.LENGTH_LONG).show();
                    }));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant