Skip to main content

HTTP

Learn how to store HTTP credentials in RAW.

HTTP Credentials refer to HTTP-accessible endpoints, as the name suggests, protected by a security mechanism. Currently, we support:

  • HTTP Basic Authentication Scheme: Is one of the simplest methods of protecting web resources. In this method the client sends a user-name and a password with the request. The server will service the request only if the user-name and password are valid for this resource.

  • Bearer Tokens: OAuth enables clients to access protected resources by obtaining an access token, which is defined in The OAuth 2.0 Authorization Framework as a "string representing an access authorization issued to the client", rather than using the resource owner's credentials directly.

info

Accessing protected API's from suppliers like: Shopify, LinkedIn, Google, Twitter etc. Is also supported. But each one of them will have it's own section explaining the necessary steps on how to generate and register them.

HTTP Basic Authentication

How to create

RAW can access HTTP resources protected by HTTP Basic Authentication mechanism. To define the respective credentials, you should click on the HTTP button in the list of Credentials. In the Http Type drop-down menu, select Http Basic and then you will be presented with the following form:

The following fields need to be specified:

  • Name: name you want to give to this credential.
  • Username: username
  • Password: password

How to use from Snapi

For example, if we want to access protected resource https://myprotected.site.com/, with username user1 and a proper password, we could register a credential named my-credential like this: HTTP Basic Authentication

Then reference this credential in the read command by using the authCredentialName parameter like this:

String.ReadLines(
Http.Get(
"https://myprotected.site.com/",
authCredentialName = "my-credential"
)
)

HTTP Access Token

How to create

In this type of credential a Bearer Token is externally generated and it is registered RAW directly. Bearer Tokens are the predominant type of access token used with OAuth 2.0.

When using this credential RAW will just send the HTTP request with the token in the Authorization header as specified in the Bearer Token Usage Specification.

How to use from Snapi

We want o access an service protected with an access token.

For that purpose, a new access token is generated externally, and we will register an new credential RAWService with this token.

HTTP OAuth2 Token Generic

This can be used to invoke a protected endpoint https://dev-nuhynxsvnkentel.raw-labs.com/scopetest/1/public/ISS/isslocation, using the following query:

String.ReadLines(
Http.Get(
"https://dev-nuhynxsvnkentel.raw-labs.com/scopetest/1/public/ISS/isslocation",
authCredentialName = "RAWService"
)
)