A 401 Unauthorized error during the Web Push SDK integration typically indicates that the apiToken parameter is either missing or incorrect in your SDK initialization code.
To resolve this issue, please follow these steps:
Locate your Device API Token. You can find this token in your Pushwoosh Control Panel by navigating to your web application's settings, then to the API Access section.
Verify your SDK initialization code. Ensure that you are passing the Device API Token to the
Pushwoosh.init()method using theapiTokenparameter.
Here is an example of a correct initialization:
Pushwoosh.init({
logLevel: 'info',
applicationCode: 'XXXXX-XXXXX', // Your Pushwoosh Application Code
apiToken: 'YOUR_DEVICE_API_TOKEN', // Your Device API Token from API Access
defaultNotificationTitle: 'Pushwoosh',
defaultNotificationImage: 'https://cp.pushwoosh.com/img/logo-medium.png'
});
Make sure that the value for apiToken in your code exactly matches the Device API Token found in your project's API Access settings.
Comments
0 comments
Please sign in to leave a comment.