> For the complete documentation index, see [llms.txt](https://developers.authopia.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.authopia.io/docs/front-end/front-end-integration-overview.md).

# Front-end Integration Overview

Authopia’s widget has few possible options to be displayed

## Fully fledged widget

<figure><img src="/files/epHAARWOx1ZxPnIAV3fX" alt="" width="375"><figcaption></figcaption></figure>

## Button only

<figure><img src="/files/7BrasPcdaWkhHwa1e1dt" alt="" width="375"><figcaption></figcaption></figure>

Its UI and translations are configurable while integrating the widget if needed.&#x20;

{% hint style="info" %}
For **local** development use **PROJECT ID** of your **Sandbox** project in the admin panel, otherwise you would need to set up an HTTPS environment and change localhost to your project's domain for the widget to work properly.
{% endhint %}

As a first step you’ll need to install the package via npm:

```shell
npm install @authopia/widget
```

Next to integrate the widget you need to put this into your frontend code:

* Load the widget component:

```javascript
import { defineCustomElements } from '@authopia/widget/loader';
import '@authopia/widget/dist/authopia-widget/authopia-widget.css';

defineCustomElements(window);
```

* Embed the widget web component

{% code overflow="wrap" %}

```html
<authopia-widget
    email="YOUR EMAIL"
    project-id="PASTE YOUR PROJECT ID HERE"
    text="Register"
/>
```

{% endcode %}

* If you want to bind to onSuccess event:

```javascript
const authopiaWidget = document.querySelector("authopia-widget")
authopiaWidget.onSuccess = function () {
  alert('success');
}
```

* If your project uses typescript you can add `global.d.ts` for better typing:

```typescript
declare namespace JSX {
  import { AuthopiaWidgetElement } from '@authopia/widget';

  interface IntrinsicElements {
    'authopia-widget': AuthopiaWidgetElement;
  }
}
```

After a successful authentication flow an ID token is returned via onSuccess method


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.authopia.io/docs/front-end/front-end-integration-overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
