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 🙏

© 2026 – Pkg Stats / Ryan Hefner

fluig-api

v1.0.2

Published

Angular service and HttpClient Interceptor for handling authentication in Fluig platform applications during local development.

Readme

Fluig API

Fluig API is an Angular service designed to simplify authentication and integration for Fluig platform applications, specifically for developers while developing locally, without the need to constantly build and push to a server to test the Angular app. It provides a wrapper for OAuth-based HTTP request authentication, and environment configuration.

Key Features

  • OAuth Integration: Simplifies authentication using OAuth 1.0a.
  • Environment-Specific Configurations: Easy switching between local and production environments.
  • HTTP Request Handling: Provides pre-configured methods for GET, POST, DELETE, PUT, and PATCH.
  • Token Management: Automatic injection of OAuth or Bearer authentication headers.

Pre-requisites and Dependencies

Ensure the following dependencies are installed:

The package.json includes the additional peer dependencies:

"peerDependencies": {
  // ...
  "crypto-js": "^4.2.0",
  "oauth-1.0a": "^2.2.6"
}

Be sure to install these dependencies as devDependencies in your project.

PNPM

pnpm install -D crypto-js oauth-1.0a

NPM

npm install --save-dev crypto-js oauth-1.0a

Installation

To install Fluig API in your Angular project, execute the following command:

PNPM

pnpm install fluig-api

NPM

npm install fluig-api

Configuration

Environment Variables

Set up the environment.ts and environment.development.ts file:

// environment.development.ts
import { FluigAPIConfig } from 'fluig-api';

type Environment = Record<string, any> & { fluigAPI: FluigAPIConfig };

export const environment = {
  fluigAPI: {
    local: true, // enables token injection. In production, set this to false.
    debug: true,
    url: 'https://your-fluig-server.com',
    endpoints: ['/content-management', '/public', '/api', '/portal'],
    oauth: {
      consumerKey: 'consumer_key',
      consumerSecret: 'consumer_secret',
      accessToken: 'access_token',
      tokenSecret: 'token_secret',
    },
  },
};

For production, you need to disable local mode, as the app will be served from the Fluig server itself, which already handles authentication:

// environment.ts
import { FluigAPIConfig } from 'fluig-api';

type Environment = Record<string, any> & { fluigAPI: FluigAPIConfig };

export const environment = {
  fluigAPI: { local: false },
};

Angular Module Configuration

Add the FLUIG_API_CONFIG provider to your ApplicationConfig:

// app.config.ts
import { provideHttpClient, withInterceptors } from '@angular/common/http';

import { environment } from '../environments/environment';
import { provideFluigAPI, fluigAPIInterceptor } from 'fluig-api';

export const appConfig: ApplicationConfig = {
  providers: [
    // You must use `provideFluigAPI(config)`. This allows the package
    // to not use libraries like `crypto-js` and `oauth-1.0a` when not needed.
    provideFluigAPI(environment.fluigAPI),
    // Optionally add the interceptor to the HTTP client
    provideHttpClient(withInterceptors([fluigAPIInterceptor])),
  ],
};

Usage Example

Inject the FluigAPIService in your component or service:

import { Component, OnInit, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FluigAPIService } from 'fluig-api';

@Component({
  selector: 'app-root',
  templateUrl: './app.html',
  styleUrls: ['./app.css'],
})
export class App implements OnInit {
  private readonly http = inject(HttpClient);
  private readonly fluigAPI = inject(FluigAPIService);

  ngOnInit(): void {
    // Example API call using FluigAPIService
    // With this service, the OAuth headers are automatically added
    this.fluigAPI
      .get('/api/public/2.0/users/getCurrent')
      .subscribe((response) => console.log(response));

    // Example API call using `HttpClient` with `FluigAPI interceptor`.
    // The interceptor automatically adds the `OAuth` headers to the requests.
    // You might be better off using the `FluigAPIService` directly, though.
    // As you will need to manage the endpoints yourself in the environments config.
    this.http
      .get('/api/public/2.0/users/getCurrent')
      .subscribe((response) => console.log(response));
  }
}

Contributions

Contributions are welcome! Feel free to fork this repository and submit pull requests.

Contact Information

For issues or inquiries, please contact the repository owner: