Skip to content

How do I use different authorization methods with REST Services

1. Basic Authentication: Providing Basic Authorization - credentials for a REST Service.

2. Digest Authentication: Accessing a REST service with Digest Authentication with encryption MD5/SHA.

Description:

This example demonstrates how to authenticate REST Web Services using different authentication and encryption methods.

In this solution shown below, you open web services block by using "wsBlockOpen" command and by using "wsAuthenticationType" you have to set the authentication (Ex: Basic or Digest). Now set the user name and password by using "wsSetUsername" and "wsSetPassword" commands. Then close the ws block by using "wsBlockEnd" command.

Solution:

Approach 1:

In this example, you will get to know how to provide the Basic Authorization details using ws commands in Worksoft SaaS:

# Command Target Value
wsCONNECT block open
1 wsBlockOpen

Set authentication type
2 wsAuthenticationType Basic
Set username
3 wsSetUsername
your username to authorize the service
Set password
4 wsSetPassword
your password
wsCONNECT block end
5 wsBlockEnd

Approach 2:

In this example, you will get to know how to provide the Digest authentication details using ws commands in Worksoft SaaS.
# Command Target Value
wsCONNECT block open
1 wsBlockOpen

Set authentication type
2 wsAuthenticationType Digest
Set username
3 wsSetUsername
your username to authorize the service
Set password
4 wsSetPassword
your access key(Digest access key for authorization)
wsCONNECT block end
5 wsBlockEnd

Tips, Tricks, Gotchas & Best Practices:  

  • All the ws commands should be in between "wsBlockOpen" and "wsBlockEnd".
  • Authentication type should be given before username and password.
  • Use the encryption icon present in the target field to encrypt the password.


Feedback and Knowledge Base