New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

restomax-auth

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

restomax-auth

Restomax Auth is an Angular 7.0.x module to use easly Google Connection OAuth 2.0 Angular auth use Angular Material for the form component and angular firestore.

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Restomax Auth

Restomax Auth is an Angular 7.0.x module to use easly Google Connection OAuth 2.0 Angular auth use Angular Material for the form component and angular firestore.

Install module

npm install --save restomax-auth

Import module

import { RMXAuthModule } from 'restomax-weather';

@NgModule({
  imports: [
    ...
    RMXAuthModule,
    ...
  ],
  ...
})
export class AppModule {}

Use Module/Component

<rmx-auth-login afterLoginPage="/home" loginPage="/login"></rmx-auth-login>

Use canActivate to your angular routes

import { NgModule } from  '@angular/core';
import { CommonModule } from  '@angular/common';
import { Routes, RouterModule } from  '@angular/router';
import { RMXAuthGuard } from 'restomax-auth';

const routes: Routes = [
  {
    path: '',
    redirectTo: 'home',
    pathMatch: 'full'
  },
  {
    path:  'login',
    component:  LoginPage
  },
  {
    path:  'home',
    component:  HomePage,
    canActivate: [RMXAuthGuard]
  }
];

@NgModule({
  imports: [CommonModule, RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export  class  AppRoutingModule { }

Use RMXAuth provider

import { Component, OnInit } from  '@angular/core';
import { RMXAuthService, IUser, ICredentials } from  'restomax-auth';

@Component({
  selector:  'your-component',
  templateUrl:  'your.component.html',
  styleUrls: ['your.component.scss'],
})
export  class  YourComponent  implements  OnInit {
  constructor(private auth: RMXAuthService) {}

  connect(type: 'subscribe' | 'password' | 'facebook' | 'twitter' | 'google', credentials: ICredentials) {
    this.auth.signIn('password', credentials)
      .then(() => console.log('You are now connected'))
      .catch(e => console.error('Auth connect error: ' + e));
  }

  disconnect() {
    this.auth.signOut()
      .then(() => console.log('You are now disconnected'))
      .catch(e => console.error('Auth disonnect error: ' + e));
  }

  checkUserConnectionStatus() {
    console.log(this.auth.authenticated ? 'User is auhentificated' : 'User is diconnected');
  }

  resetPassword(credentials: ICredentials) {
    this.auth.resetPassword(credentials)
      .then(message => console.log(message))
      .catch(e => console.error(e))
  }

  ngOnInit() {
    this.auth.userSubject.subscribe((userInfo: IUser)  => {
      if(!userInfo) { return; }
      console.log('userInfo: ' + JSON.stringify(userInfo));
      console.log('idToken: ' + this.auth.idToken);
    });
  }
}

Next doc TODO

Complete doc...

FAQs

Package last updated on 31 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc