Mpeterson
12 years agoOccasional Contributor
Oauth; Differences in Content from Postman?
I am doing oauth api testing and using postman I can do all the calls successfully. However when I try to utilize SoapUIPro 4.6.4 the requests, they fail for invalid token.
I am using the Twitter example as a base, with the event triggering the script from the twitter example
The GET lines are in Postman:
GET /api/20130409/system/institutions HTTP/1.1
Host: qa3appxxxxxx.cloudapp.net
Authorization: OAuth realm="http://qa3xxxxxx.cloudapp.net/api/20130409/system/institutions",oauth_consumer_key="6E65A733-B50B-4BAF-A15F-xxxxxxxxxxxx",oauth_token="4b51464f-e527-4d91-9623-e4183c52fa29",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1389979234",oauth_nonce="QwwBQv",oauth_version="1.0",oauth_signature="EPL9nnAKx3ApbHgiAlXzLfXyMDxxxx"
Cache-Control: no-cache
In SoapUIPro
Authorization: OAuth oauth_consumer_key="6E65A733-B50B-4BAF-A15F-xxxxxxxxxxxxx", oauth_nonce="-3223282616829841309", oauth_signature="1yTGVd6sZo8LTMe1w8SsJVGjo3xxxx", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1389979349", oauth_token="4b51464f-e527-4d91-9623-e4183c52fa29", oauth_version="1.0"
}
I am obviously reaching the host as i get a error reply, I did note the difference in the oauth_nonce value, however Postman works if I post in the value generated by soap.
The script triggered by the event maybe the issue, however I do not really understand what "project" is defined as. I do not see where the item specified are defined to tell what its pointed at.
// get project
def project = com.eviware.soapui.model.support.ModelSupport.getModelItemProject( request )
// initialize OAuth consumer
def consumer = new oauth.signpost.commonshttp.CommonsHttpOAuthConsumer(
project.getPropertyValue( "oauth_consumer_key" ),
project.getPropertyValue( "oauth_consumer_secret" ));
consumer.setTokenWithSecret(
project.getPropertyValue( "oauth_access_token" ),
project.getPropertyValue( "oauth_access_token_secret" ));
// sign the request
consumer.sign( context.httpMethod )
So my question to you is, how is the project defined in the script? Is there a method to emulate the same pattern in the request as is utilized in POSTMAN?
Am I missing something tragically easy?
Mark
I am using the Twitter example as a base, with the event triggering the script from the twitter example
The GET lines are in Postman:
GET /api/20130409/system/institutions HTTP/1.1
Host: qa3appxxxxxx.cloudapp.net
Authorization: OAuth realm="http://qa3xxxxxx.cloudapp.net/api/20130409/system/institutions",oauth_consumer_key="6E65A733-B50B-4BAF-A15F-xxxxxxxxxxxx",oauth_token="4b51464f-e527-4d91-9623-e4183c52fa29",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1389979234",oauth_nonce="QwwBQv",oauth_version="1.0",oauth_signature="EPL9nnAKx3ApbHgiAlXzLfXyMDxxxx"
Cache-Control: no-cache
In SoapUIPro
Authorization: OAuth oauth_consumer_key="6E65A733-B50B-4BAF-A15F-xxxxxxxxxxxxx", oauth_nonce="-3223282616829841309", oauth_signature="1yTGVd6sZo8LTMe1w8SsJVGjo3xxxx", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1389979349", oauth_token="4b51464f-e527-4d91-9623-e4183c52fa29", oauth_version="1.0"
}
I am obviously reaching the host as i get a error reply, I did note the difference in the oauth_nonce value, however Postman works if I post in the value generated by soap.
The script triggered by the event maybe the issue, however I do not really understand what "project" is defined as. I do not see where the item specified are defined to tell what its pointed at.
// get project
def project = com.eviware.soapui.model.support.ModelSupport.getModelItemProject( request )
// initialize OAuth consumer
def consumer = new oauth.signpost.commonshttp.CommonsHttpOAuthConsumer(
project.getPropertyValue( "oauth_consumer_key" ),
project.getPropertyValue( "oauth_consumer_secret" ));
consumer.setTokenWithSecret(
project.getPropertyValue( "oauth_access_token" ),
project.getPropertyValue( "oauth_access_token_secret" ));
// sign the request
consumer.sign( context.httpMethod )
So my question to you is, how is the project defined in the script? Is there a method to emulate the same pattern in the request as is utilized in POSTMAN?
Am I missing something tragically easy?
Mark