Sign In

@hellocoop/api

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hellocoop/api

Client API for Hellō https://hello.dev

Source
npmnpm
Version
2.4.7
Version published
Weekly downloads
229
252.31%
Maintainers
2
Weekly downloads
 
Created
Source

@hellocoop/api

This npm package is a TypeScript implementation of the Hellō Web Client API that is used by:

  • @hellocoop/express
  • @hellocoop/fastify
  • @hellocoop/nextjs
  • @hellocoop/cdk-client

Hellō Web Client API

The API is a single route, that by default is /api/hellocoop. Having a single route simplifies integration into an application. The endpoint handles the API as well as being the protocol endpoint for the OpenID Connect redirect_uri and third party initiated login.

The web client calls the API by passing the op query command set to one of the operations (auth|login|logout|invite)

router.ts routes the commands to the different modules

auth

Returns the auth object:

    {
        "isLoggedIn": false
    }

    {
        "isLoggedIn": true,
        "sub": "sub_vvCgtpv35lDgQpHtxmpvmnxK_2nZ",
        "iat": 1699234659,
        "name": "Dick Hardt",
        "picture": "https://pictures.hello.coop/r/7a160eed-46bf-48e2-a909-161745535895.png",
        "email": "dick.hardt@hello.coop"
    }

Implemented in auth.ts

login

The client loads /api/hellocoop?op=login to start a login flow.

Optional parameters described in Web Client API

This will:

  • discover the redirect_uri if not configured by bouncing a page to the browser to learn the full URL for the endpoint
  • generate a PKCE code_verifier and code_challenge
  • generate a nonce
  • encrypt and store the redirect_uri, code_verifier, and nonce in the hello_oidc cookie
  • create an authorization request and return a 302 redirect to that URL

Implemented in login.ts

logout

The client loads /api/hellocoop?op=logout to clear the auth cookie and log the user out.

Optional parameters described in Web Client API

Implemented in logout.ts

invite

The client loads /api/hellocoop?op=invite to start the invite flow.

See the Invite API for details.

Implemented in invite.ts

OpenID Connect Protocol

Authorization Response

The API endpoint is the redirect_uri and is where the user is redirected after interacting with their Hellō Wallet.

If a successful login at Hellō, the endpoint receives an authorization code query parameter (code). It then will:

  • retrieve and decrypt the redirect_uri, code_verifier, and nonce from the hello_oidc cookie
  • exchange the code, redirect_uri, code_verifier for the id_token at the Hellō token endpoint (`https://wallet.hello.coop/)
  • verify the id_token contains the nonce and perform standard id_token verification
  • call the loginSync function if configured
  • set the hellocoop_auth cookie
  • redirect the user to the target_uri

If the user is an administrator of the Hellō application and it is running at a dynamic endpoint and the wildcard_console parameter is returned, an intermediate page is generated by wildcard.ts and presented to the developer to simplify configuration of their application.

If the log in was unsuccessful or canceled, the endpoint receives an error query parameter and the user is redirected to an error page.

Implemented in callback.ts

Third Party Initiated Login

This allows a user to log in to an application by clicking a link in a dashboard or loading a bookmark. The endpoint is passed the iss query parameter, which must be the Hellō issuer, https://issuer.hello.coop. login_hint or domain_hint can optionally be provided.

Implemented in initiateLogin.ts

Keywords

hello

FAQs

Package last updated on 15 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts