If your application's logs show a 401 Unauthorized error during device registration and no subscribers appear in your Pushwoosh Control Panel, it typically means that the requests from the Pushwoosh SDK are not being properly authenticated.
This issue is most often caused by a missing Device API token in your app's native configuration files. This token is a mandatory security feature required to authorize communication between your app and Pushwoosh servers.
To resolve this, you must add your Device API token to the appropriate configuration file for each platform.
1. Locate Your Device API Token
First, find your token in the Pushwoosh Control Panel by navigating to your application's API Access section.
2. Add the Token to Your Application
For Android:
Add the following <meta-data> tag inside the <application> tag in your AndroidManifest.xml file. Replace YOUR_DEVICE_API_TOKEN with the actual token from your Pushwoosh account.
<application>
...
<meta-data
android:name="com.pushwoosh.apitoken"
android:value="YOUR_DEVICE_API_TOKEN" />
...
</application>
For iOS:
Add a new key to your Info.plist file. Set the key to Pushwoosh_API_TOKEN and the value (as a string) to your actual Device API token.
<key>Pushwoosh_API_TOKEN</key>
<string>YOUR_DEVICE_API_TOKEN</string>
After adding the token to your project's configuration, rebuild your application. New installations should now be able to register successfully without the 401 Unauthorized error.
Comments
0 comments
Please sign in to leave a comment.