HowTo: Quality Center / REST API / VBScript – Non-Web Application Authentication with Basic Authorization Header
Question ID: 105770
0
0

How Do I authenticate with Basic Authorization header using REST API / VBScript?

Marked as spam
Posted by (Questions: 122, Answers: 3)
Asked on January 2, 2015 5:07 pm
261 views
Answers (1)
0
Private answer

**Example**

Sub Authenticate_AuthHeader()

Dim XMLHttpRequestObj, ALMServer, ALMAuthString

Set XMLHttpRequestObj = CreateObject(''Msxml2.ServerXMLHTTP.6.0'')

ALMServer = ''http://localhost:8080/qcbin'' ''<--No trailing slash ''Base64 encoded string of user:pass Example: Base64(''alex_alm:'') is YWxleF9hbG06
ALMAuthString = ''YWxleF9hbG06''

XMLHttpRequestObj.open ''GET'', ALMServer & ''/authentication-point/authenticate'', False
XMLHttpRequestObj.setRequestHeader ''Content-Type'',''application/xml''
XMLHttpRequestObj.setRequestHeader ''Authorization'',''Basic '' & ALMAuthString
XMLHttpRequestObj.send

MsgBox ''-- Authenticate Header --'' & vbCrLf & _
''Status Code : '' & XMLHttpRequestObj.status & vbCrLf & _
''Status Text : '' & XMLHttpRequestObj.statusText & vbCrLf & _
''---------------------------'' & vbCrLf & vbCrLf & _
''Response Text : '' & vbCrLf & XMLHttpRequestObj.responseText, , ''Authenticate''

Set XMLHttpRequestObj = Nothing

End Sub

Marked as spam
Posted by (Questions: 3, Answers: 168)
Answered on January 2, 2015 5:34 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top