Authentication


Next step to set authentication for your plugin. In Authentication Configuration viasocket provide three types of authentication methods for your application :

ūüĒī¬†NOTE : If any service support base64 conversion then select Basic auth in that case.


    

Authentication Configuration - No Auth

Typically, 'No Auth' is used when the service does not require authentication to access its API. This is commonly applicable for open APIs. 


Authentication Configuration - Basic Auth

Typically, basic authentication requires the service's api-key. The processes to obtain an API key and the necessary fields are covered in detail in the service's documentation. Click here to know how basic auth works in viaSocket.


Authentication Configuration - OAuth 2.0

Auth2.0 works by delegating user authentication to the service that hosts the user account and authorizing third-party applications to access the user account. 


Type 1: Authorization Code

To implement OAuth 2.0 (Authorization Code) for a particular service, you typically need to register your application with the service to obtain a client ID and client secret, set up redirection endpoints to handle callbacks, and create logic to obtain and refresh access tokens using the client credentials. Click here to learn more about Authorization code.

Type 2: Implicit Auth

Implicit authentication, an OAuth 2.0 grant type, enables the client application to receive the access token directly from the authorization server via the redirection URI, without needing an intermediate authorization code, using only the client ID. Click here to learn more about Implicit auth in viaSocket.


Type 3: Client Credentials 

The Client Credentials grant type in OAuth 2.0 uses a client ID and secret to get an access token. Register with the OAuth 2.0 provider to receive these credentials. Upon successful authentication, the server issues an access token. Click here for more details.


Type 4 : Password Credentials

This OAuth 2.0 grant type exchanges a user's username and password directly for an access token. Register your application with the OAuth 2.0 authorization server to obtain a client ID and client secret. To learn more about password credentials authentication type in viaSocket Click here.

ūüĒīNOTE : The fields you created for authentication are required to create actions and triggers. Use this value format : `${context.authData.fieldkey_name}`.

Test Me API: 

To complete the process of authentication the final step is to add the Test Me API . It is a simple GET API which is getting user details, profile information.This API is invoked during the authentication process of the plugin.

Sample Request with Response:


try{

let config = {
  method: 
'get',
  maxBodyLength: 
Infinity,
  url: 
'https://api.airtable.com/v0/meta/whoami',
  headers: { 
    
'Authorization': `Bearer ${context?.authData?.auth_key}`
  }
};

const response = await axios.request(config)
return response.data

}

catch(error){

    throw error

}

                 


Connection Label: 

It is a label provided to show authentication by the user when using the plugin in any of the flows. For security  purposes, "Mask connection label value"  is used to essentially conceal the actual value of the connection label. 

                   


Append Headers/Query params/Body: 

The interface you are looking at allows you to set default key-value pairs for headers, query parameters, or the body of HTTP requests where you want to send authentication data. These defaults will be applied to all actions or triggers that use the specified authentication version, ensuring consistent and necessary data is sent with each request. 


Suppose your API accepts api-key the query params and, so add Key: api-key (or the specific syntax required by your service) Value: The authentication key entered by users  

Now in any action and trigger no need to add authentication in any api it will fetch automatically


Support

For further assistance, visit the viaSocket support page or contact our support team at support@viasocket.com.