0.0.7 • Published 5 years ago

@codeda/oauth v0.0.7

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

@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));
  }

}
0.0.7

5 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago