cancel
Showing results for 
Search instead for 
Did you mean: 

User authentication - please help - traffic script

SOLVED
clint_nz
New Contributor

User authentication - please help - traffic script

Please see the attachment as its not currently letting me to copy and paste into this window. My browser is not liking me today.

1 ACCEPTED SOLUTION

Accepted Solutions
markbod
Contributor

Re: User authentication - please help - traffic script

Hi Clinton,

Your scipt is missing any code to get the username/password from the client. An example using HTTP Basic Authorization, would require something like this to be added before you run the auth.query():


$authHeader = http.getHeader("Authorization");


if ( string.startswith($authHeader, "Basic") ) {


  $decode = string.base64decode( string.skip($authHeader, 6) );


  $userpass = string.split($decode, ":");


} else {


  http.sendResponse("401 Auth Required", "text/plain", "This resource is protected. Please log in", "WWW-Authenticate: Basic realm=\"Secure Area\"");


}



$user_name = $userpass[0];


$password = $userpass[1];


Cheers,

Mark

View solution in original post

1 REPLY 1
markbod
Contributor

Re: User authentication - please help - traffic script

Hi Clinton,

Your scipt is missing any code to get the username/password from the client. An example using HTTP Basic Authorization, would require something like this to be added before you run the auth.query():


$authHeader = http.getHeader("Authorization");


if ( string.startswith($authHeader, "Basic") ) {


  $decode = string.base64decode( string.skip($authHeader, 6) );


  $userpass = string.split($decode, ":");


} else {


  http.sendResponse("401 Auth Required", "text/plain", "This resource is protected. Please log in", "WWW-Authenticate: Basic realm=\"Secure Area\"");


}



$user_name = $userpass[0];


$password = $userpass[1];


Cheers,

Mark