Topic: Authenticating with Indicia not using PHP
Hi all.
I thought I'd like to document how I've done my authentication in a non-PHP way. As it happens, I've done it in Classic ASP (I know)! But the principles should apply to any language. I'll try and be as non-specific as possible.
You firstly need a way of posting to the Indicia warehouse. I'm using a MS component to do this, but any would do...
' Get a nonce from the warehouse
' NB, you need to set the request header to the correct format
url = ".../index.php/services/security/get_read_nonce"
Set xmlHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
xmlHTTP.Open "POST", url, False
xmlHTTP.SetRequestHeader "content-type", "application/x-www-form-urlencoded"
xmlHTTP.Send "website_id=" & WEBSITE_ID
nonce = xmlHTTP.ResponseText
' Now we have the nonce we can combine that with our password to create our auth token...
' You'll need to have a way of applying a sha1 algorithm to it. I haven't included how I've done this.
' It's important that you sha1 the nonce, a colon then the password (in that order).
authToken = Sha1(nonce & ":" & PASSWORD)
You can then use the authToken to access the Indicia warehouse.
Hope this helps anyone who's not using the PHP toolkit.
Regards,
Steve.