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

oxum-login-page

v2.0.3

Published

This is a simple library to display a login page with Google Sign in

Downloads

5

Readme

Oxum Login Page

This is a simple library to display a login page with Google Sign in

Get started

npm install oxum-login-page --save

Import the module and run "initialize" method

@NgModule({
    declarations: [
        AppComponent,
    ],
    imports: [
        BrowserModule,
        OxumLoginPageModule.initialize(config), //Config should to be a OxumLoginPageConfig object
    ],
    bootstrap: [AppComponent],
})
export class AppModule {
}

where config is an instance of the object OxumLoginPageConfig.

Setup style

Oxum Login Page use Primeng to works. If you want to enable the style, please add next lines in your angular.json:

"styles": [
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/primeflex/primeflex.css",
],

Inputs

Here you have the list of options:

@Input logoPath: string = (optional) Path to the logo, by default 'assets/logo.png';

@Input loginUrl: string = (optional) Url to call after the user is logged.;


Example:

```html

<main class="p-d-flex p-flex-column">
    <oxum-login-page [enableSignInWithGoogle]="true"></oxum-login-page>
</main>

Auth Service methods

The auth service can inform you when a user is logged in. For that you can listen the BehaviourSubject isLogged$

@Component({
    selector: 'app-root',
    ...
})
export class AppComponent implements OnInit {
    logged$ = this.auth.isLogged$;

    constructor(public auth: OxumAuthService) {
    }
}

<main class="p-d-flex p-flex-column">
    <ng-container *ngIf="logged$ | async; else loginTemplate">
        <h1>Connected</h1>
    </ng-container>
    <ng-template #loginTemplate>
        <oxum-login-page></oxum-login-page>
    </ng-template>
</main>

Enable Firebase Auth

You can enable the Firebase Auth to login with your firebase account.

First, install Firebase:

ng add @angular/fire

Then add the Firebase config to environments variable. Open /src/environments/environment.ts and add your Firebase configuration. You can find your project configuration in the Firebase Console:

export const environment = {
    production: false,
    firebase: {
        apiKey: '<your-key>',
        authDomain: '<your-project-authdomain>',
        databaseURL: '<your-database-URL>',
        projectId: '<your-project-id>',
        storageBucket: '<your-storage-bucket>',
        messagingSenderId: '<your-messaging-sender-id>',
        appId: '<your-app-id>',
        measurementId: '<your-measurement-id>'
    }
};

Next, add you configuration in your Angular module:

@NgModule({
    declarations: [
        AppComponent,
    ],
    imports: [
        BrowserModule,
        OxumLoginPageModule.initialize({
            //...
            firebase: environement.firebase
        }),
    ],
    bootstrap: [AppComponent],
})
export class AppModule {
}

With those last step the Firebase auth is set up. Important: Using the Firebase auth will replace the default (user, password) authentication method.

Auth Interceptor

Oxum Login Page provides an interceptor that will disconnect the user for each http 403 response. Here is an example to set up this interceptor:

//imports

export const AuthInterceptorFactory = (authService: OxumAuthService) => {
    return new OxumAuthInterceptor(authService);
};

@NgModule({
    declarations: [
        AppComponent,
        //...
    ],
    imports: [
        BrowserModule,
        //...
    ],
    providers: [
        //...
        OxumAuthService,
        {
            provide: HTTP_INTERCEPTORS,
            useExisting: OxumAuthInterceptor,
            multi: true,
            deps: [OxumAuthService],
        },
        {
            provide: OxumAuthInterceptor,
            useFactory: AuthInterceptorFactory,
            deps: [
                OxumAuthService,
            ],
        },
    ],
    bootstrap: [AppComponent],
})

export class AppModule {
}