You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering a 403 Forbidden error when attempting to send a notification using the OneSignal::sendNotificationToUser function in Laravel. The error message suggests that the request is being denied due to a missing or invalid API key in the Authorization header. Below is the error message from the exception:
Client error: `POST https://onesignal.com/api/v1/notifications` resulted in a `403 Forbidden` response:
{"errors": ["Access denied. Please include an 'Authorization: Basic ...' header with a valid API key"]}
Code Example:
Here’s the code I’m using to send the notification:
{
"error": "one_signal_error",
"message": "Client error: `POST https://onesignal.com/api/v1/notifications` resulted in a `403 Forbidden` response:\n{\"errors\": [\"Access denied. Please include an 'Authorization: Basic ...' header with a valid API key (https:\/\/documenta (truncated...)\n",
"file": "/home/arloponc/public_html/developer/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php",
"line": 113
}
Expected Behavior:
The notification should be sent successfully when the correct OneSignal API key is used.
Actual Behavior:
The request results in a 403 Forbidden response, indicating that the API key is either missing or invalid. I have already verified the API key and added it to the environment variables, but the issue persists.
Steps to Reproduce:
Set up the OneSignal integration as per the package instructions.
Use the sendNotificationToUser function to send a notification.
The API key is set in the .env file, and I'm confident that it's correctly configured.
It appears the Authorization header isn't being properly included in the request. However, this seems to be handled internally by the package, so I'm unsure why it's failing.
Any guidance or suggestions would be appreciated.
The text was updated successfully, but these errors were encountered:
Description:
I am encountering a
403 Forbidden
error when attempting to send a notification using theOneSignal::sendNotificationToUser
function in Laravel. The error message suggests that the request is being denied due to a missing or invalid API key in the Authorization header. Below is the error message from the exception:Code Example:
Here’s the code I’m using to send the notification:
Error Message:
Expected Behavior:
The notification should be sent successfully when the correct OneSignal API key is used.
Actual Behavior:
The request results in a
403 Forbidden
response, indicating that the API key is either missing or invalid. I have already verified the API key and added it to the environment variables, but the issue persists.Steps to Reproduce:
sendNotificationToUser
function to send a notification.403 Forbidden
error in the response.Environment:
Additional Information:
.env
file, and I'm confident that it's correctly configured.Any guidance or suggestions would be appreciated.
The text was updated successfully, but these errors were encountered: