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 🙏

© 2024 – Pkg Stats / Ryan Hefner

ng-okta-auth

v0.0.14

Published

This is an angular wrapper for [Okta Auth JavaScript SDK](https://github.com/okta/okta-auth-js).

Downloads

32

Readme

ng-okta-auth

This is an angular wrapper for Okta Auth JavaScript SDK.

Quick start

  1. npm i ng-okta-auth
  2. In app.module import OktaAuthModule.forRoot() and provide the necessary configuration:
import { OKTA_AUTH_PARAMS, OKTA_UNAUTHORIZED_URL, OktaAuthModule, OktaAuthParams, OKTA_USER_STORE } from 'ng-okta-auth';

const params: OktaAuthParams = {
  issuer: environment.oktaIssuer,
  clientId: environment.oktaClientId,
  redirectUri: window.location.origin + '/auth/callback',
  tokenManager: {
    storage: 'localStorage'
  }
}

@NgModule({
  declarations: [
    AppComponent,
  ],
  imports: [
    BrowserModule,
    OktaAuthModule.forRoot(),
  ],
  providers: [
    { provide: OKTA_AUTH_PARAMS, useValue: params },
    { provide: OKTA_UNAUTHORIZED_URL, useValue: '/login' },
    { provide: OKTA_USER_STORE, useExisting: UserStoreService }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
}
  • OKTA_AUTH_PARAMS (required): initial configuration of Okta. The full description of the interface you can find here.
  • OKTA_UNAUTHORIZED_URL (required): a route, where we redirect a user after logout or some authentication errors.
  • OKTA_USER_STORE (optional): a service for saving information about current user.

User store service should have the following interface:

export interface OktaUserStore {
  setOktaUser(params: OktaUserInfo | null): void;

  // reset the value of current user. Usually it's used after logout or some authorization errors
  resetUser(): void;
}

OktaAuthService

It's a core service for working with okta authentication. It has the following methods:

  • initAuthorization(): Observable<OktaUserInfo | null>- loads current user (using getUserInfo() method), based on auth token, and puts it in user store (if user store and user exist).
  • checkAuthenticated(): Observable<boolean> - checks if current user is authenticated. It doesn't information about user.
  • getUserInfo(): Observable<OktaUserInfo> - loads detailed information about authorized user.
  • login(username, password): Observable<OktaUserInfo> - login, loads (using getUserInfo() method) and puts an authorized user to the user store (if it exists)
  • logout(): Observable<void> - logout and clear information about current user in the user store (if it exists)