php-onesignal-sdk icon indicating copy to clipboard operation
php-onesignal-sdk copied to clipboard

Error When Trying To Create App

Open MejorCodigo opened this issue 8 years ago • 1 comments

I keep getting this error when I try to create an app:

stdClass Object
(
    [status] => 
    [code] => 400
    [response] => stdClass Object
        (
            [errors] => Array
                (
                    [0] => Your subdomain must only contain lowercase letters, numbers, and dashes (not as a starting or ending character) and must be between 4 and 14 characters long.
                )

        )

)

This is the code I'm using to create an app:

use NNV\OneSignal\OneSignal;
use NNV\OneSignal\API\App;
  
$oneSignal = new OneSignal("<Auth Key Here>");
$app = new App($oneSignal);

$appData = [
    'name' => 'My App',
    'chrome_web_origin' => "http://my-domain.com",
    'chrome_web_sub_domain' => "https://subdomain.os.tc",
    'apns_env' => 'production'
];

$response = $app->create($appData);

echo "<pre>", print_r($response), "</pre>";

Any help in fixing this issue is greatly appreciated. :)

MejorCodigo avatar Aug 26 '17 19:08 MejorCodigo

@MejorCodigo I think you try to remove https:// (or/and .os.tc) from your subdomain :smiley:!

namnv609 avatar Oct 09 '17 13:10 namnv609