dcsimg

How to pass credentials in a REST URL

Products

Webtrends 9.x

Cause

At times, it is useful to create a REST URL that also includes the user credentials. This violates security best practices, instead, pass the credentials in a POST request rather than in a GET request. Theninclude the username and password on the headers of the POST request

Example URL:https://ws.webtrends.com/v3/Reporting/profiles/

Examplecredentials:
Account Name: accountname
Username: username
Password: password

Therequest would be:

POST /v3/Reporting/profiles/ HTTP/1.1
HOST: ws.webtrends.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 49

username=accountname%5Cusername&password=password

Note that the “\” that is normally between the account name and user name has to be URL encoded.