npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@cambridge-pte/adonisjs6-gigya

v1.0.0

Published

Gigya integration for AdonisJS v6 applications

Readme

AdonisJS Gigya Package

Gigya integration for AdonisJS v6 applications

This package provides seamless integration with Gigya's Customer Identity Access Management (CIAM) platform for AdonisJS applications. It includes a service provider, type definitions, and a convenient service wrapper for easy usage throughout your application.

Installation

Install the package using your preferred package manager:

npm install @cambridge-pte/adonisjs6-gigya
yarn add @cambridge-pte/adonisjs6-gigya
pnpm add @cambridge-pte/adonisjs6-gigya

Install Gigya SDK (Required for TypeScript)

If you plan to create service wrappers with TypeScript support, you'll also need to install the Gigya SDK for type definitions:

npm install gigya@npm:@cambridge-pte/gigya@^3.0.5
yarn add gigya@npm:@cambridge-pte/gigya@^3.0.5
pnpm add gigya@npm:@cambridge-pte/gigya@^3.0.5

Note: The Gigya SDK is already included as a dependency in this package for runtime usage. You only need to install it separately if you want TypeScript type definitions in your service wrappers.

Configuration

1. Register the Provider

Add the Gigya provider to your adonisrc.ts file:

import { defineConfig } from '@adonisjs/core/app'

export default defineConfig({
  // ...other configuration
  providers: [
    // ...other providers
    () => import('@cambridge-pte/adonisjs6-gigya/gigya_provider'),
  ],
})

2. Create Configuration File

Create a configuration file at config/gigya.ts:

import { defineConfig } from '@adonisjs/core/app'
import env from '#start/env'

const gigyaConfig = defineConfig({
  /**
   * Gigya API key
   */
  apiKey: env.get('GIGYA_API_KEY'),

  //...rest
})

export default gigyaConfig

3. Environment Variables

Add the required environment variables to your .env file:

GIGYA_API_KEY=your_gigya_api_key
GIGYA_DATA_CENTER=us1
GIGYA_SECRET=your_gigya_secret

# OR for user key authentication:
# GIGYA_USER_KEY=your_user_key
# GIGYA_SECRET_KEY=your_secret_key

# OR for RSA authentication:
# GIGYA_RSA_USER_KEY=your_rsa_user_key
# GIGYA_RSA_PRIVATE_KEY=your_rsa_private_key

# Optional settings
GIGYA_TIMEOUT=10000
GIGYA_DEBUG=false

Usage

Direct Container Access

You can access the Gigya instance directly from the IoC container:

import app from '@adonisjs/core/services/app'

// In a controller, service, or other class
const gigya = await app.container.make('gigya')
const response = await gigya.accounts.getAccountInfo({ UID: 'user-id' })

Service Wrapper (Recommended)

Create a service wrapper for easier usage throughout your application. Create the file app/services/gigya/main.ts:

import app from '@adonisjs/core/services/app'
import { Gigya } from 'gigya'

let gigya: Gigya

await app.booted(async () => {
  gigya = await app.container.make('gigya')
})

export { gigya as default }

Using the Service in Controllers

import { HttpContext } from '@adonisjs/core/http'
import gigya from '#services/gigya/main'

export default class AuthController {
  async search({ request, response }: HttpContext) {
    const { email } = request.all()

    try {
      const result = await gigya.accounts.search({
        query: `SELECT * FROM accounts where profile.email=${email}`,
      })
      return response.json({ success: true, data: result })
    } catch (error) {
      return response.status(400).json({
        success: false,
        error: error.message,
      })
    }
  }
}

Authentication Methods

The package supports three authentication methods with Gigya:

Secret-based Authentication

// config/gigya.ts
export default defineConfig({
  apiKey: 'your_api_key',
  dataCenter: 'us1',
  secret: 'your_secret_key',
})

User Key Authentication

// config/gigya.ts
export default defineConfig({
  apiKey: 'your_api_key',
  dataCenter: 'us1',
  userKey: 'your_user_key',
  secretKey: 'your_secret_key',
})

RSA Authentication

// config/gigya.ts
export default defineConfig({
  apiKey: 'your_api_key',
  dataCenter: 'us1',
  rsa: {
    userKey: 'your_rsa_user_key',
    privateKey: 'your_rsa_private_key',
  },
})

API Reference

The service wrapper provides direct access to the Gigya instance. Once imported, you can use any Gigya SDK method:

import gigya from '#services/gigya/main'

// Use any Gigya SDK method
await gigya.accounts.getAccountInfo({ UID: 'user-id' })
await gigya.accounts.register({ email: '[email protected]', password: 'password' })
await gigya.accounts.login({ loginID: '[email protected]', password: 'password' })
await gigya.accounts.logout({ UID: 'user-id' })

For the complete Gigya API, refer to the official Gigya documentation.

License

MIT