Embed Authentication Architecture
Step-by-step breakdown of how the backend and frontend interact to pass the necessary JWT token for authentication.

Backend (Your App Backend)
• Create an Endpoint: First, create an endpoint on your backend to generate the JWT token for the user.
• Generate JWT Token: The backend generates the JWT token after validating the user’s session or credentials. The token is generated using your unique org_id, user_id, project_id, and an access key. (Learn how to generate JWT Token)
• Encryption: The JWT token is encrypted using HS256, ensuring secure transmission.
• Send JWT Token: Once generated, the backend sends the JWT token to the frontend.
Frontend (Your App Frontend):
• Request the JWT Token: The frontend sends a request to the backend’s endpoint, triggering the backend to generate the JWT token.
• Receive the Token: The frontend receives the JWT token from the backend.
• Embed Token: The JWT token is embedded in the script tag with the ID viasocket-embed-main-script as the embedToken parameter. This ensures each user has a unique flow, securing data isolation.viaSocket Embed:
• Send Token to viaSocket Embed: After receiving the JWT token, the frontend passes it along with the embed request to the viaSocket embed.
• Authentication and Loading Embed: The viaSocket embed authenticates using the JWT token and, if successful, loads the embedded component within your platform.
Watch this Demo :
Note:
• The demo uses Webhook as the primary app. You can replace this with your own app.
• For testing with your configuration, replace org_id, projectid, and secret with your embedding credentials, which you’ll receive during the embed creation process.