# @gooddollar/goodlogin-sdk

> Login SDK for login with Gooddollar wallet

Latest version **1.1.37** (published 2025-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gooddollar/goodlogin-sdk
pnpm add @gooddollar/goodlogin-sdk
yarn add @gooddollar/goodlogin-sdk
bun add @gooddollar/goodlogin-sdk
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.37 |
| Published | 2025-08-05 |
| First published | 2022-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 35.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | sirpush, lbwgd |

## Links

- npm: https://www.npmjs.com/package/@gooddollar/goodlogin-sdk
- npm.io page: https://npm.io/package/@gooddollar/goodlogin-sdk

## Dependencies (3)

- [web3](https://npm.io/package/web3.md) ^1.7.4
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [@gooddollar/goodprotocol](https://npm.io/package/@gooddollar/goodprotocol.md) ^2.0.32

## Recent versions

- 1.1.37 (latest) — 2025-08-05
- 1.1.36-beta.83c9b913 (beta) — 2025-03-20
- 1.1.36 — 2025-03-25
- 1.1.35 — 2024-11-05
- 1.1.34 — 2024-08-09
- 1.1.33 — 2024-07-29
- 1.1.32 — 2023-11-14
- 1.1.31 — 2023-11-13
- 1.1.30 — 2023-07-23
- 1.1.29 — 2023-07-10
- 1.1.29-beta.3f3be0f — 2023-07-10
- 1.1.29-beta.21d85c2 — 2023-06-30
- 1.1.28-beta.7bc9fe9 — 2023-06-27
- 1.1.28 — 2023-06-27
- 1.1.28-beta.34739b3 — 2023-06-21
- … 62 more at https://npm.io/package/@gooddollar/goodlogin-sdk/versions

## README

# GoodDollar Client SDK
This is the gooddollar client sdk for integrating login into gooddollar in your website
- [Example App](https://gooddollar.netlify.app/) to test the functionality
- [Source Code to the example app](https://github.com/harjaapdhillon16/gooddollarLoginExample)

## SDK Utilities
 - createLoginLink to generate login link to redirect to the gooddollar wallet 
 - LoginButton to place a login button on your page to integrate login with gooddollar on your website
 - parseLoginResponse to verify if the login was successful and verified
 - useLogin is a hook that can be used instead of button to integrate login with gooddollar on your website

## Object schema for createLoginLink 

| Property Name | Purpose | Mandatory/Optional | Type |
| --- | --- | --- |  --- |
| redirectLink | gooddollar wallet link to redirect to | Optional | String |
| v | name of the vendor | Mandatory | String |
| web | web link for vendor | Mandatory | String |
| id | wallet address for vendor | Mandatory | String |
| r | array of information ex.['mobile','location'] | Mandatory | array |
| cbu | Callback URL | provide either rdu or cbu | String |
| rbu | Redirect URL | provide either rdu or cbu | String |

## Object schema for useLogin

| Property Name | Purpose | Mandatory/Optional | Type |
| --- | --- | --- | --- |
| gooddollarlink | wallet link returned by createLoginLink | Mandatory | String |
| cbu | Callback URL | provide either rdu or cbu | String |
| rbu | Redirect URL | provide either rdu or cbu | String |
| onLoginCallback | Function that has the data returned by wallet as the first argument | Mandatory | Function |

## Props for LoginButton

| Prop Name | Purpose | Mandatory/Optional | Type |
| --- | --- | --- | --- |
| gooddollarlink | wallet link returned by createLoginLink | Mandatory | String |
| cbu | Callback URL | provide either rdu or cbu | String |
| rbu | Redirect URL | provide either rdu or cbu | String |
| onLoginCallback | Function that has the data returned by wallet as the first argument | Mandatory | Function |

## example login with hook
```js
import {
  useLogin,
  createLoginLink,
  parseLoginResponse,
} from "@gooddollar/goodlogin-sdk";

const App() {
  const gooddollarLink = createLoginLink({
    v: "Google",
    web: "https://gooddollar.netlify.app",
    id: "0x09D2011Ca5781CA70810F6d82837648132762F9a",
    r: ["mobile", "location", "email", "name"],
    rdu: "https://gooddollar.netlify.app",
  });

  const loginCallBack = async (data) => {
    //to check if login response is valid or not 
    parseLoginResponse(data)
  }

  const onClick =  useLogin({
    rdu: gooddollarLink,
    gooddollarlink: rest.gooddollarlink,
    onLoginCallback: onLoginCallback,
  });

  return (
    <div className="App">
      <button onClick={onClick}>Login With Gooddollar</button>
    </div>
  );
}
```

## example login with button
```js
import {useState} from 'react';
import {
  LoginButton,
  createLoginLink,
  parseLoginResponse,
} from "@gooddollar/goodlogin-sdk";

function App() {
  const gooddollarLink = createLoginLink({
    v: "Google",
    web: "https://gooddollar.netlify.app",
    id: "0x09D2011Ca5781CA70810F6d82837648132762F9a",
    r: ["mobile", "location", "email", "name"],
    rdu: "https://gooddollar.netlify.app",
  });

  const [gooddollarData, setGooddollarData] = useState({});

  return (
    <div className="App">
        {Object.keys(gooddollarData).length === 0 ? (
          <>
            <LoginButton
              onLoginCallback={async (data) => {
              //to check if login response is valid or not 
              parseLoginResponse(data)
              setGooddollarData(data)
              }}
              gooddollarlink={gooddollarLink}
              style={{ fontSize: 20, padding: 20 }}
              rdu="gasdasd"
            >
              Loggin With GOODDOLLAR
            </LoginButton>
          </>
        ) : (
          <div>
            <p>Logged In</p>
            <p>Name : {gooddollarData.fullName}</p>
            <button
              onClick={() => {
                setGooddollarData({});
                window.location.href = "https://gooddollar.netlify.app";
              }}
              style={{ fontSize: 20, padding: 20 }}
            >
              Logout
            </button>
          </div>
        )}
    </div>
  );
}
```

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