question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: JSON deserialization error

See original GitHub issue

Issue

I am facing an obscure JSON deserialization error during the following code.

const config = {
  clientId: SPOTIFY_CLIENT_ID,
  redirectUrl: `com.spotibet:/oauthredirect`,
  scopes: ["user-read-email", "user-read-private"],
  serviceConfiguration: {
    authorizationEndpoint: "https://accounts.spotify.com/authorize",
    tokenEndpoint: "https://some.herokuapp.com/something"
  },
};

try {
  const result = await authorize(config);
} catch(error) {
  console.log(error)
}

The login screen from spotify is shown and I can provide credentials, when I cklick “agree”, the error occurs.

JSON deserialization error
    at Object.promiseMethodWrapper [as authorize] (NativeModules.js:103)
    at authorize (index.js:187)
    at login$ (auth.js:46)
    at tryCatch (runtime.js:45)
    at Generator.invoke [as _invoke] (runtime.js:274)
    at Generator.prototype.<computed> [as next] (runtime.js:97)
    at tryCatch (runtime.js:45)
    at invoke (runtime.js:135)
    at runtime.js:170
    at tryCallTwo (core.js:45)

The tokenEndpoint https://some.herokuapp.com/something in the config is an express server that will get an auth_code from spotify, do some logic and finally return with a res.json(...). Server-wise everything works fine for ios and android. However, on android the app throws the catched error above, when the server returns with res.json(...)

adb logcat

08-02 18:32:57.229  2037 16730 I ActivityTaskManager: START u0 {act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=com.spotibet:/oauthredirect?code=AQBvUoY4eb1qtCGFfKBjhvEvSMIcxDf0Dm5BqAiWuWEBDUw2aMezYnBn6jV2xcnZL_n5ZipvW_vtnlN8sGLfYzgo8OxQH6hJip_DO1VPSakIOj57os8_oNdBaezQMMZNYCJn81IH02SWQfAZqxPVKiqb6_jp4jN8b2VSBD7rj4R-LIrVSZe1xbaR-Xvyy7x2xQigDs9OV-M-DHLKZvItcT8aQ5KqEQR6E_USzG7U-FIi0Q35XXfYOBahs4kBUG1xEz9YjGaYvmCF6dKNhe0-d-zQ8wH2Qw&state=c3i5veUyP6ZzbpWDNA3hjg flg=0x14000000 cmp=com.spotibet_app2/net.openid.appauth.RedirectUriReceiverActivity (has extras)} from uid 10131
08-02 18:32:57.279  2037  2141 D ConnectivityService: releasing NetworkRequest [ TRACK_DEFAULT id=186, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED Uid: 10131] ] (release request)
08-02 18:32:57.279  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.282  2037 16730 I chatty  : uid=1000(system) Binder:2037_1F identical 38 lines
08-02 18:32:57.282  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.289 31028 31028 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@ee15e39
08-02 18:32:57.292  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.292  2037 16730 I chatty  : uid=1000(system) Binder:2037_1F identical 8 lines
08-02 18:32:57.292  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.312 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.318 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.348 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.357 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.382 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.383 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.392 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.393 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.403 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.405  2037 16730 I ActivityTaskManager: START u0 {dat=com.spotibet:/oauthredirect?code=AQBvUoY4eb1qtCGFfKBjhvEvSMIcxDf0Dm5BqAiWuWEBDUw2aMezYnBn6jV2xcnZL_n5ZipvW_vtnlN8sGLfYzgo8OxQH6hJip_DO1VPSakIOj57os8_oNdBaezQMMZNYCJn81IH02SWQfAZqxPVKiqb6_jp4jN8b2VSBD7rj4R-LIrVSZe1xbaR-Xvyy7x2xQigDs9OV-M-DHLKZvItcT8aQ5KqEQR6E_USzG7U-FIi0Q35XXfYOBahs4kBUG1xEz9YjGaYvmCF6dKNhe0-d-zQ8wH2Qw&state=c3i5veUyP6ZzbpWDNA3hjg flg=0x24000000 cmp=com.spotibet_app2/net.openid.appauth.AuthorizationManagementActivity} from uid 10185
08-02 18:32:57.407  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.417  2037 16730 W ActivityTaskManager: Duplicate finish request for ActivityRecord{c6a2d0e u0 com.spotibet_app2/net.openid.appauth.RedirectUriReceiverActivity t100 f}
08-02 18:32:57.408  2037 16730 I chatty  : uid=1000(system) Binder:2037_1F identical 8 lines
08-02 18:32:57.408  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.446 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.466  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.476  2037 16730 I chatty  : uid=1000(system) Binder:2037_1F identical 38 lines
08-02 18:32:57.476  2037 16730 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.520 27859 27910 I cr_BindingManager: onTrimMemory: level=20, size=1
08-02 18:32:57.549  2037  5910 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.550  2037  5910 I chatty  : uid=1000(system) Binder:2037_16 identical 8 lines
08-02 18:32:57.550  2037  5910 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.594  1797  1944 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 9592832
08-02 18:32:57.667  1797  1944 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 9592832
08-02 18:32:57.675 31028 31066 D EGL_emulation: eglMakeCurrent: 0xd651b140: ver 3 0 (tinfo 0xd650fbc0)
08-02 18:32:57.676  1797  1864 D gralloc_ranchu: gralloc_alloc: Creating ashmem region of size 9592832
08-02 18:32:57.711  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:32:57.712  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:32:57.747  2037  5910 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.780  2037  5910 I chatty  : uid=1000(system) Binder:2037_16 identical 48 lines
08-02 18:32:57.780  2037  5910 W InputReader: Device has associated, but no associated display id.
08-02 18:32:57.811 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.828  2172  2486 D EGL_emulation: eglMakeCurrent: 0xde5e2280: ver 3 0 (tinfo 0xde670d20)
08-02 18:32:57.852 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.919 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:57.940  2037  2064 I ActivityTaskManager: Displayed com.spotibet_app2/net.openid.appauth.AuthorizationManagementActivity: +514ms
08-02 18:32:57.993 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.119 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.149 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde612020: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.152 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.170 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.195 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.204 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.238 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.242 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987f9a0: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.261  1778 31178 E ResolverController: No valid NAT64 prefix (101, <unspecified>/0)
08-02 18:32:58.273 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987e980: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.283 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.289 27963 27989 D EGL_emulation: eglMakeCurrent: 0xe987e980: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.342 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.347 27859 27931 D EGL_emulation: eglMakeCurrent: 0xd651c340: ver 3 0 (tinfo 0xb7cd2ff0)
08-02 18:32:58.468  1778 31184 E ResolverController: No valid NAT64 prefix (101, <unspecified>/0)
08-02 18:32:58.516 27859 27859 W cr_ContextualSearch: Warning, the 0 state was aborted.
08-02 18:32:58.573  2037  2055 I ActivityManager: Killing 30882:com.android.chrome:sandboxed_process2:org.chromium.content.app.SandboxedProcessService2/u0a131i88 (adj 0): isolated not needed
08-02 18:32:58.574  1779  1779 D Zygote  : Forked child process 31185
08-02 18:32:58.603  2037  2055 I MediaFocusControl: abandonAudioFocus() from uid/pid 10131/27859 clientId=android.media.AudioManager@8b942a5org.chromium.content.browser.AudioFocusDelegate@3699c9a
08-02 18:32:58.626  2037  2066 W ActivityManager: Slow operation: 191ms so far, now at startProcess: returned from zygote!
08-02 18:32:58.627  2037  2066 W ActivityManager: Slow operation: 191ms so far, now at startProcess: done updating battery stats
08-02 18:32:58.627  2037  2066 W ActivityManager: Slow operation: 192ms so far, now at startProcess: building log message
08-02 18:32:58.627  2037  2066 I ActivityManager: Start proc 31185:com.android.chrome:sandboxed_process3:org.chromium.content.app.SandboxedProcessService3/u0i89 for service {com.android.chrome/org.chromium.content.app.SandboxedProcessService3}
08-02 18:32:58.627  2037  2066 W ActivityManager: Slow operation: 192ms so far, now at startProcess: starting to update pids map
08-02 18:32:58.627  2037  2066 W ActivityManager: Slow operation: 192ms so far, now at startProcess: done updating pids map
08-02 18:32:58.637 31185 31185 W ProcessService: Unexpected CPU variant for X86 using defaults: x86
08-02 18:32:58.699 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde612020: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.708  1779  1779 I Zygote  : Process 30882 exited cleanly (0)
08-02 18:32:58.709  2037  2067 I libprocessgroup: Successfully killed process cgroup uid 99088 pid 30882 in 131ms
08-02 18:32:58.716  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:32:58.716  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:32:58.735 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.770  2037  6056 W AppOps  : Noting op not finished: uid 10101 pkg com.google.android.gms code 41 time=1596385973718 duration=0
08-02 18:32:58.747 27963 27989 D EGL_emulation: eglMakeCurrent: 0xde613100: ver 3 0 (tinfo 0xde5f9620)
08-02 18:32:58.772 31185 31185 I ProcessService: The ClassLoaderContext is a special shared library.
08-02 18:32:58.778 31185 31185 I ProcessService: The ClassLoaderContext is a special shared library.
08-02 18:32:58.762 31185 31185 W ProcessService3: type=1400 audit(0.0:511): avc: denied { getattr } for path="/data/data/com.android.chrome" dev="vdc" ino=22296 scontext=u:r:isolated_app:s0:c129,c291,c512,c768 tcontext=u:object_r:app_data_file:s0:c131,c256,c512,c768 tclass=dir permissive=0 b/120394782
08-02 18:32:58.772 31185 31185 W ProcessService3: type=1400 audit(0.0:512): avc: denied { getattr } for path="/data/data/com.android.chrome" dev="vdc" ino=22296 scontext=u:r:isolated_app:s0:c129,c291,c512,c768 tcontext=u:object_r:app_data_file:s0:c131,c256,c512,c768 tclass=dir permissive=0 b/120394782
08-02 18:32:58.794 31185 31185 I LoadedApk: No resource references to update in package com.google.android.trichromelibrary
08-02 18:32:58.799 31185 31185 I cr_ChildProcessService: Creating new ChildProcessService pid=31185
08-02 18:32:58.873 31185 31206 I cr_LibraryLoader: Time to load native libraries: 26 ms (timestamps 5814-5840)
08-02 18:32:58.881 31185 31206 I chromium: [INFO:library_loader_hooks.cc(50)] Chromium logging enabled: level = 0, default verbosity = 0
08-02 18:32:58.882 31185 31206 I cr_LibraryLoader: Expected native library version number "74.0.3729.185", actual native library version number "74.0.3729.185"
08-02 18:32:58.941 31028 31028 W m.spotibet_app: JNI critical lock held for 18.951ms on Thread[1,tid=31028,Runnable,Thread*=0xe9837800,peer=0x728ac1f0,"main"]
08-02 18:32:59.716  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:32:59.716  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:33:00.005  2172  2172 D KeyguardClockSwitch: Updating clock: 633
08-02 18:33:00.020  2172  2486 D EGL_emulation: eglMakeCurrent: 0xde5e2280: ver 3 0 (tinfo 0xde670d20)
08-02 18:33:00.492  1778 31216 E ResolverController: No valid NAT64 prefix (101, <unspecified>/0)
08-02 18:33:00.717  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:33:00.717  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:33:01.552 31028 31028 W m.spotibet_app: Accessing hidden field Landroid/widget/ScrollView;->mScroller:Landroid/widget/OverScroller; (greylist, reflection, allowed)
08-02 18:33:01.723  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:33:01.723  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:33:02.502  1778 31217 E ResolverController: No valid NAT64 prefix (101, <unspecified>/0)
08-02 18:33:02.725  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:33:02.725  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:33:03.725  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:33:03.725  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:33:04.522  1778 31218 E ResolverController: No valid NAT64 prefix (101, <unspecified>/0)
08-02 18:33:04.730  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: a: input svInfo.flags is 8
08-02 18:33:04.730  1795  2271 E GnssHAL_GnssInterface: gnssSvStatusCb: b: input svInfo.flags is 8
08-02 18:33:04.753  2037 14020 W AppOps  : Noting op not finished: uid 10101 pkg com.google.android.gms code 41 time=1596385978770 duration=0

Environment

  • Your Identity Provider: Spotify
  • Platform that you’re experiencing the issue on: Android Simulator (ios works fine)
  • Are you using Expo? no

I would be very happy for any hint towards the underlying problem. Thank you very much.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
ndbeyercommented, Aug 10, 2020

I have not tried every value separately. Thanks for the help.

1reaction
kadikramancommented, Aug 9, 2020

Well, access_token, token_type are listed as required in the spec although the rest aren’t. Are all of those values definitely required? It might be possible that AppAuth-Android is making some assumptions about the return type while AppAuth-iOS doesn’t.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JSON Deserialization Error in C# - Stack Overflow
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or...
Read more >
Serialization Error Handling - Json.NET
The Error event is an event handler found on JsonSerializer. The error event is raised whenever an exception is thrown while serializing or...
Read more >
JSON Deserialize error - OutSystems
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is...
Read more >
Error deserializing a JSON response - MSDN - Microsoft
Hello,. I am trying to get the following JSON response into a list so I can reference on value and get another :...
Read more >
[Solved] Newtonsoft json deserialize error - CodeProject
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found