Skip to content
Last updated

Iframe integration process

This section explains how to embed Spotnana as an iframe within your application using OAuth 2.0 token exchange authentication.

Overview

The integration consists of two parts:

  • Backend: Your server authenticates with Spotnana on behalf of your users. It sends a user token to Spotnana, and our system returns an access token and a refresh token. These tokens allow the iframe to load an authenticated session for that user.
  • Frontend: Your application loads the Spotnana iframe and handles a token exchange. When the iframe loads, Spotnana automatically sends your page a message requesting tokens. Your page responds with the tokens your backend obtained from Spotnana. This communication happens through the browser's postMessage API, which is the standard way for a parent page and an iframe on different domains to exchange data securely.

Spotnana URLs

The following are the base URLs to access the Spotnana platform:

Sequence diagram

The sequence diagram below explains the token exchange flow between Spotnana and your application in an iframe integration:

Spotnana APIYour backend systemYour frontend applicationSpotnana APIYour backend systemYour frontend application1. Authenticate2. Generate signed JWT(containing user email signed with private key)3. POST /v2/auth/oauth-token(with JWT as the subject_token)4. Validate API credentials5. Validate JWT signatureusing your JWKS public key6. Extract email from the JWT7. Look up Spotnana user using the email8. Return access_token and refresh_token9. Return tokens to render the iframe.10. Render iframe after successful authentication.

Setup process

The information provided below explain the complete iframe setup process: