← 法人向けページへ戻るiframe導入サイトデモ
アクリルフリーのデモページです
HOME / アクリルグッズ / アクリルフリー

アクリルグッズ 1個から作成

iframeで埋め込む

永続シークレットはサーバーだけで使い、ブラウザには短期の embedToken だけを渡します。
// Server Component または Route Handler(サーバーでのみ実行)
const response = await fetch('https://wota-maker.com/api/embed/session', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.WOTAMAKER_EMBED_SECRET}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ parentOrigin: process.env.NEXT_PUBLIC_SITE_ORIGIN }),
  cache: 'no-store',
});
const { embedToken } = await response.json();

// 商品ページ
<iframe
  title="グッズシミュレーター"
  src={`/embed?embedToken=${encodeURIComponent(embedToken)}`}
  sandbox="allow-scripts allow-same-origin allow-forms"
  referrerPolicy="origin"
  style={{ width: '100%', minHeight: 720, border: 0 }}
/>