Hi,
I'm trying to connect to a wordpress site and get a Json web token back.
This is the code I am sending
sURL is string="[ardemo.agency.atlasrepublic.co];
sUser is string="xxxxxx"
sPwd is string="xxxxxx"
sHTTPRequest is httpRequest
sHTTPRequest..User=sUser
sHTTPRequest..Password=sPwd
sHTTPRequest..URL=sURL
sHTTPRequest..Method=httpPost
sHTTPRequest..ContentType="application/json"
cMyResponse is httpResponse = HTTPSend(sHTTPRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse..Content)
END
When I execute this I get the following error back.
{"code":"jwt_auth_bad_auth_header","message":"Authorization header malformed.","data":{"status":403}}
1. I have not been able to figure out how to display what the content of message being sent is so I have no what to know what teh message actually looks like. Any tips on how to trap that?
2. The instructions for how to do this in JQuery are below. I don;t know JQuery so I'm not sure what, if anything I'm missing. Anyone know how to read this to see what, if anything I'm missing?
$.ajax({
url: 'https://ardemo.agency.atlasrepublic.co/wp-json/jwt-auth/v1/token',
method: 'POST',
crossDomain: true,
beforeSend: function ( xhr ) {
xhr.setRequestHeader( 'Authorization', 'Basic ' + Base64.encode( 'username:password' ) );
},
success: function( data, txtStatus, xhr ) {
console.log( xhr.status );
},
error: function( error ) {
console.log( error );
}
});
Thanks!
Steve
I'm trying to connect to a wordpress site and get a Json web token back.
This is the code I am sending
sURL is string="[ardemo.agency.atlasrepublic.co];
sUser is string="xxxxxx"
sPwd is string="xxxxxx"
sHTTPRequest is httpRequest
sHTTPRequest..User=sUser
sHTTPRequest..Password=sPwd
sHTTPRequest..URL=sURL
sHTTPRequest..Method=httpPost
sHTTPRequest..ContentType="application/json"
cMyResponse is httpResponse = HTTPSend(sHTTPRequest)
IF ErrorOccurred THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(cMyResponse..Content)
END
When I execute this I get the following error back.
{"code":"jwt_auth_bad_auth_header","message":"Authorization header malformed.","data":{"status":403}}
1. I have not been able to figure out how to display what the content of message being sent is so I have no what to know what teh message actually looks like. Any tips on how to trap that?
2. The instructions for how to do this in JQuery are below. I don;t know JQuery so I'm not sure what, if anything I'm missing. Anyone know how to read this to see what, if anything I'm missing?
$.ajax({
url: 'https://ardemo.agency.atlasrepublic.co/wp-json/jwt-auth/v1/token',
method: 'POST',
crossDomain: true,
beforeSend: function ( xhr ) {
xhr.setRequestHeader( 'Authorization', 'Basic ' + Base64.encode( 'username:password' ) );
},
success: function( data, txtStatus, xhr ) {
console.log( xhr.status );
},
error: function( error ) {
console.log( error );
}
});
Thanks!
Steve