berkayk / laravel-onesignal

OneSignal Push Notifications for Laravel
506 stars 176 forks source link

Send Notification with External User ID return 403 Forbidden #172

Open caktoy opened 2 years ago

caktoy commented 2 years ago

My Code:

OneSignal::sendNotificationToExternalUser(
    $message,
    $to,
    $url = null,
    $data = null,
    $buttons = null,
    $schedule = null,
    $title
);

I'am tested it in local environment and everything working, but when I'am tried in server production it return error that says:

local.ERROR: GuzzleHttp\Exception\ClientException: Client error: `POST https://onesignal.com/api/v1/notific><!DOCTYPE html>
<html lang="en-US">
<head>
    <title>Just a moment...</title>
    <meta http-equiv="Content-Type" conte (truncated...)
 in /var/www/sm-rab-api/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /var/www/sm-rab-api/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create()
#1 /var/www/sm-rab-api/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#2 /var/www/sm-rab-api/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler()
#3 /var/www/sm-rab-api/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}>#4 /var/www/sm-rab-api/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run()
#5 /var/www/sm-rab-api/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#6 /var/www/sm-rab-api/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#7 /var/www/sm-rab-api/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
more...

Please help and give me an advice what I need to do to solve the problem.

berkayk commented 2 years ago

If it's working in a local environment, you should check your production server's settings.