@codeda/oauth
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

@codeda/oauth

Angular module for authorization by social networks.

Installation

Using npm:

$ npm install @codeda/oauth

Using yarn:

$ yarn add @codeda/oauth

Usage

  1. Import OAuthModule: import { OAuthModule } from '@codeda/oauth';
  2. Import it into you application module:
@NgModule({
  imports:[
    OAuthModule.forRoot({
      google: {
        clientId: ${yourClientIdHere}  
      },
      linkedIn: {
        api_key: ${yourApiKeyHere}
      },
      facebook: {
        appId: ${yourAppIdHere}
      }
    })
  ]
})
export class AppModule {}
  1. Add OAuthGuard into main route:
const routes: Routes = [
  {
    path: '',
    canActivate: [OAuthGuard],
    children: [...]
  }
];
  1. Now you can use OAuthService for authorization:
import { OAuthService } from '@codeda/oauth';

@Component({...})
export class MyComponent {
    
  constructor(oauth: OAuthService) {
    oauth
      .signInByGoogle()
      .subscribe(user => console.log(user));
  }

}

Package Sidebar

Install

npm i @codeda/oauth

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

240 kB

Total Files

29

Last publish

Collaborators

  • looffee