Main interface to the Identity API.
Use button() to create the Identity button and on() to subscribe to events.
See Identity API for full documentation.
Example 1: Generate button with SDK
This is the recommended and preferred method of integration
Example Group
identity-js mode=tabs label="JavaScript"
Description
"Create the Identity button, mount it to a container, subscribe to render/click/signin/error events, and unmount on cleanup."
// SECOND BUTTON RENDERED IN THE SAME PAGE constsiwkButton2 = klarna.Identity.button({ scope:"profile:name profile:email", redirectUri:"http://localhost:3000/callback", // Notice, for multiple buttons we need to provide an ID id:'secondIdentityButton', })
Main interface to the Identity API. Use
button()to create the Identity button andon()to subscribe to events. See Identity API for full documentation.Example 1: Generate button with SDK
This is the recommended and preferred method of integration
Example Group
identity-js mode=tabs label="JavaScript"
Description
"Create the Identity button, mount it to a container, subscribe to render/click/signin/error events, and unmount on cleanup."
Example Tab Label
"1.1 Render the Identity Button"
Example Tab Label
"1.2 Capture events"
Example Tab Label
"1.3 Cleanup"
Example 2: Attach Identity Button behavior to a custom button
Example Group
identity-html-2 mode=stack label="HTML (custom button)"
Description
"Use your own button in the DOM and attach Identity behavior with attach(). Register events and detach when done."
Example Group
identity-js mode=tabs label="JavaScript"
Example Tab Label
"2.2 Attach Identity Button behavior"
Example Tab Label
"2.3 Capture events"
Example Tab Label
"2.4 Cleanup"
Example Tab Label
"3. Multiple Identity Buttons"
Example Group
identity-css mode=stack label="CSS"
Description
"Optional: customize button dimensions (min width 48px, height 35–60px)."