"401 Unauthorized" usually means the Device API token is missing or wrong:
1. It isn't added to the application's config (AndroidManifest.xml for Android, Info.plist for iOS)
2. It has the wrong type — for example a Server API token is used instead of a Device API token
3. It lacks permission for your project
To fix the issue:
1. Create a Device API token in the Pushwoosh Control Panel: Settings → API Access. Tokens are account-level and you choose which projects each token can access. See API Access token.
2. Make sure the token has permission for your app:
3. Add the token to the configuration of the app:
Android: AndroidManifest.xml file:
<meta-data android:name="com.pushwoosh.apitoken" android:value="__YOUR_DEVICE_API_TOKEN_FROM_PW_CONTROL_PANEL__" />
iOS: Info.plist — use the current key Pushwoosh_API_TOKEN:
<key>Pushwoosh_API_TOKEN</key>
<string>__YOUR_DEVICE_API_TOKEN_FROM_PW_CONTROL_PANEL__</string>
Note: the older key PW_API_TOKEN is still read as a legacy fallback, but Pushwoosh_API_TOKEN takes precedence and is the key the SDK's integration validator expects. If both are present, Pushwoosh_API_TOKEN wins.
Example error log:
2025-05-06 08:49:12.863 5743-5822 Pushwoosh com.pushwoosh.demoapp E [RequestManager] ERROR: {"status_code":401,"status_message":"Unauthorized"}
com.pushwoosh.internal.network.NetworkException: {"status_code":401,"status_message":"Unauthorized"}
at com.pushwoosh.internal.network.c.a(SourceFile:8)
at com.pushwoosh.internal.network.c.a(SourceFile:1)
at com.pushwoosh.internal.network.c$b.a(SourceFile:1)
at com.pushwoosh.internal.network.c$b.doInBackground(Unknown Source:2)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
Comments
0 comments
Please sign in to leave a comment.