# @svgator/sdk-frontend

> SDK frontend for SVGator API

Latest version **1.1.1** (published 2026-08-26) · ISC license · 0 weekly downloads

## Install

```sh
npm install @svgator/sdk-frontend
pnpm add @svgator/sdk-frontend
yarn add @svgator/sdk-frontend
bun add @svgator/sdk-frontend
```

## Health

**Score 50/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2026-08-26 |
| First published | 2020-10-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 16 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Tibor Vincze |
| Maintainers | dzsamper, louis.gorbe |

## Links

- npm: https://www.npmjs.com/package/@svgator/sdk-frontend
- Repository: https://github.com/SVGator/SDK.git#master
- Homepage: https://www.svgator.com/
- Issues: https://github.com/SVGator/SDK/issues
- npm.io page: https://npm.io/package/@svgator/sdk-frontend

## Recent versions

- 1.1.1 (latest) — 2026-08-26
- 1.1.0 — 2025-11-12
- 1.0.7 — 2025-04-15
- 1.0.6 — 2022-04-12
- 1.0.5 — 2020-12-14
- 1.0.4 — 2020-12-10
- 1.0.3 — 2020-11-24
- 1.0.2 — 2020-10-29
- 1.0.1 — 2020-10-22
- 1.0.0 — 2020-10-21

## README

## SVGator's JavaScript Frontend SDK
This JS SDK lets your users connect their SVGator account with your application. Please note that SVGator **strongly recommends the usage of the Frontend SDK** over direct API calls.

### Before You Start

In order to use SVGator's API & SDKs, one first must obtain an SVGator Application. To do so, please email [contact@svgator.com](mailto:contact@svgator.com?subject=SVGator%20Application%20Request&body=Dear%20Support%2C%0D%0A%0D%0AMy%20name%20is%20%5BJOHN%2FJANE%20DOE%5D%20from%20%5BCOMPANY%2C%20INC.%5D.%0D%0APlease%20add%20an%20SVGator%20application%20to%20my%20account%20of%20%5BEMAIL%40COMPANY.COM%5D%2C%20in%20order%20to%20offer%20my%20users%20to%20connect%20their%20SVGator%20accounts%20with%20my%20software.), providing your SVGator account ID and the desired usage of your SVGator application.

The API keys one should receive from [contact@svgator.com](mailto:contact@svgator.com?subject=SVGator%20Application%20Request&body=Dear%20Support%2C%0D%0A%0D%0AMy%20name%20is%20%5BJOHN%2FJANE%20DOE%5D%20from%20%5BCOMPANY%2C%20INC.%5D.%0D%0APlease%20add%20an%20SVGator%20application%20to%20my%20account%20of%20%5BEMAIL%40COMPANY.COM%5D%2C%20in%20order%20to%20offer%20my%20users%20to%20connect%20their%20SVGator%20accounts%20with%20my%20software.) are shown below:

| Name | Description | Notes | Sample Value |
|------|------|------------|----------|
| `app_id` | Application ID |prefixed with "ai_", followed by 32 alphanumeric chars|`ai_b1357de7kj1j3ljd80aadz1eje782f2k`|
| `secret_key` | Secret Key |prefixed with "sk_", followed by 32 alphanumeric chars|`sk_58ijx87f45596ylv5jeb1a5vicdd92i4`|



<table>
  <thead>
    <tr>
      <th align="left">
        :exclamation: Attention
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
          :black_medium_small_square: Your Secret Key must not be included in any requests, neither be present on Front-End.
      </td>
    </tr>
  </tbody>
</table>


Creating an application on the fly is also possible using [`appId=dynamic`](../../master/README.md#2iii-dynamic-app-creation), yet this feature comes with restrictions. For a multi-user implementation follow the steps above instead. 

### Requirements
- nodejs >= 7.6 (for self-hosted version)
- none (for CDN version hosted by SVGator.com)

### Installation
Run the following command in the directory where you want to install the module (for self-hosted version only):
```
npm i @svgator/sdk-frontend
```
Optionally, you can also use SVGator's CDN to load the latest version of frontend SDK into your site using [this CDN Link](https://cdn.svgator.com/sdk/svgator-frontend.latest.js). Find a [detailed example here](./example.html).

### Usage as Node Module
```js
const SVGatorFrontend = require("@svgator/sdk-frontend");
// You may also import our module by:
// import SVGatorFrontend from "@svgator/sdk-frontend";

let appId = 'ai_...';
let returnPage = 'https://example.com/my-return-url/?some=arguments';

async function loginWithPopup() {
    let {auth_code, auth_code_expires} = await SVGatorFrontend.auth(appId);
    // @todo return auth_code to your backend & obtain an access_token with it
}

function loginWithRedirect() {
    SVGatorFrontend.auth(appId, returnPage);
    // @todo on `returnPage`, handle the &auth_code=ac_... argument & obtain an access_token using it
}

// initiated by a user action (i.e. click on a log in button), one should call loginWithPopup() OR loginWithRedirect()
```

### Usage from CDN
Find a [detailed example here](./example.html).

```html
<!DOCTYPE html>
<html>
<head>
    <script src="https://cdn.svgator.com/sdk/svgator-frontend.latest.js"></script>
    <script>
        function loginWithPopup()
        {
            let appId = 'ai_...';
            window.SVGator
                .auth(appId)
                .then(function (result) {
                    // @todo return result.auth_code to your backend & obtain an access_token with it
                }).catch(function (result) {
                let msg = result && result.msg || "Unknown Error";
                msg += result && result.code ? ' (#' + result.code + ')' : '';
                console.log(msg);
            });
        }

        function loginWithRedirect()
        {
            let appId = 'ai_...';
            // @todo return auth_code from redirected URL params to your backend & obtain an access_token with it
            window.SVGator.auth(appId, document.location.href);
        }
    </script>
</head>
<body>
    <button onclick="loginWithPopup()">Connect to SVGator with Popup</button>
    <br>
    <br>
    <button onclick="loginWithRedirect()">Connect to SVGator with Redirect</button>    
</body>
</html>
```

---
_Source: https://npm.io/package/@svgator/sdk-frontend · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
