Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
NSC | Generate Signature for Token-Based Authentication
Token Based Authentication is widely used in NetSuite Integrations such as RESTlets, SOAP Web Services, and SuiteAnalytics Connect. As part of the TBA Authorization Flow, the Timestamp, Signature, and Nonce must be supplied to generate the signature.
The sample code below must be ran using PowerShell:
$nonce=''
$set="anyrandomcharactercombinationhere123".ToCharArray()
for($x=0;$x-lt20;$x++){
$nonce+=$set|Get-Random
}
$account='xxxxxxx'#NetSuite Account ID
#Consumer Key and Secret from the Integration Record, Token and Token Secret from the User’s Access Tokens
$consumer_Key='xxxxx'
$consumer_secret='xxxxx'
$token='xxxxxxx'
$token_secret='xxxxxxx'
$timestamp=[int][double]::Parse((Get-Date(get-date).touniversaltime()-UFormat%s))
$timestamp=[string]$timestamp
$msg=$account+'&'+$consumer_Key+'&'+$token+'&'+$nonce+'&'+$timestamp
$secret=$consumer_secret+'&'+$token_secret
$hmacsha=New-ObjectSystem.Security.Cryptography.HMACSHA256
$hmacsha.key=[Text.Encoding]::ASCII.GetBytes($secret)
$signature=$hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($msg))
$signature=[Convert]::ToBase64String($signature)
echo$timestamp
echo$signature
echo$nonce
Refer a Member to the Community | Earn the Answer Accepter Badge | Vote for the contents you'd like to see
Tagged:
0
