Discussions
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Inbound SSO Map PHP Help!!!!
We are using phptoolkit 2013. This code always throws exception "An unexpected error occurred."
global $nsendpoint, $nshost, $nsemail, $nspassword, $nsrole, $nsaccount, $partnerId;
$service = new NetSuiteService();
$role = new RecordRef();
$role->internalId = 3;
$priv_key_der = file_get_contents(APP_PATH . 'rsa-Private.der');
$priv_key_pem = chunk_split(base64_encode($priv_key_der), 64, "\n");
$priv_key_pem = "-----BEGIN RSA PRIVATE KEY-----\n" . $priv_key_pem . "-----END RSA PRIVATE KEY-----\n";
$priv_res = openssl_pkey_get_private($priv_key_pem);
$timestamp = round(vsprintf("%d%d", gettimeofday()), -3) / 1000;
$userId = $nsemail;
$ssotoken = $role->externalId . " " . $nsemail . " " . $timestamp;
openssl_private_encrypt($ssotoken, $ssotokenEnc, $priv_res);
$authToken = strtoupper(bin2hex($ssotokenEnc));