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

@kimaya-hybrid/ngx-auth-service

v1.0.2

Published

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.1.0.

Readme

AuthHandler

This project was generated with Angular CLI version 8.1.0.

How Install

npm install @kimaya/ngx-auth-service

Dependency

You need to install dependencies manually

CookieStorage this is being used to store all cookies in this library.

Plug into your application

Note**: Please provide AuthService into your core module.

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AuthService } from 'ngx-auth-service';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule
  ],
  providers: [ AuthService ],
  bootstrap: [AppComponent]
})
export class AppModule { }

How to use

Inject into your Component or Service.

    constructor(private oAuthService: AuthService) {
    }

AuthService Configure

User can configure some of keys for auth service as per project requirements.

User need to set AuthServiceConstants keys for usages.

Need to set serverUrl and endPoint. This will be used to hit login api using httpService

ServerUrl is host endPoint is api end point

| Keys | Required | Default Value| Usage| |-------------|-------------|-----|-----| | headerToken | true |Basic | used to send in header for login | | accessTokenKey | true |accToken | used to store access token in cookie | | refreshTokenKey | true |refToken | used to store refresh token in cookie |
| expiresInKey | true |exprIn | used to store expire time in cookie |
| loggedInKey | true |loggedIn | used to check whether user is loggeIn or not from cookie |
| redirectPath | true |/ | used for redirecting after system logut | | serverUrl | true | null | used for http request host |
| login | true | null | used for http request for login and refresh token api end point | | logout | true | null | used for http request for logout api end point | | headers | false | {} | Provide extra headers for all Http request including multipart request |

Object for login

    export class OAuthRequestProto {
      username: string;
      password: string;
      scope: string = 'write';
      grant_type: string = 'password';
      realm: string;
      authType: string;
      refresh_token: string;
    }

Methods

getAccessToken(): string;

    const accessToken: string = oAuthService.getAccessToken();

will return access token which is stored using cookie service in cookie.

getRefreshToken(): string;

    const refreshToken: string = oAuthService.getRefreshToken();

will return refresh token which is stored using cookie service in cookie.

setUserLoggedIn(): void;

    oAuthService.setUserLoggedIn();

It will store cookie for loggedIn using loggedInKey from configure constants.

isLoggedIn(): boolean;

    const isLoggedIn: boolean = oAuthService.isLoggedIn();

check whether user is loggedIn or not.

logoutSystem(): Observable;

    oAuthService.logoutSystem().subscribe((response) => {
    // to remove all cookie and redirect to page [default '/']
    oAuthService.removeUsersDetailsAndRedirect();
    });
    

logout user from system via api calling and after success remove all cookie value from cookie and redirect to configured page.

login(object: OAuthRequestProto): Observable;

    oAuthService.login(object).subscribe((response) => {
        oAuthService.storeAccessTokenResponse(
        response.accessToken,
        response.expiresIn, 
        response.refreshToken
        );
        oAuthService.setUserLoggedIn();
    });

to login into system.

refreshToken(): Observable;

    oAuthService.refreshToken().subscribe((response) => {
    oAuthService.storeAccessTokenResponse(
            response.accessToken,
            response.expiresIn, 
            response.refreshToken
            );
    oAuthService.setUserLoggedIn();
    });

to refresh token when access token get expired.

storeAccessTokenResponse(accessToken: string, expiresIn: string, refreshToken: string): void;

    oAuthService.storeAccessTokenResponse(
                    response.accessToken,
                    response.expiresIn, 
                    response.refreshToken
                    );

to store token and expiry details for session.

For more Information

you can contact on [email protected]