@verzth/ngx-tcx
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Release

tcx-js

Angular Library for TCX Authentication Module, it use in client side to help make auth simpler.

It's standalone library (not include TCX JS)

Dependencies

Installation

NPM

npm i ngx-tcx

or

npm i --save ngx-tcx

Yarn

yarn add ngx-tcx

How to Use:

  1. Use TCX in your providers and inject it in your related component constructor.

    .....
    import {TCX} from 'ngx-tcx';
    .....
    
    @Component(
     {
         ...
         providers: [
             TCX
         ]
         ...
     }
    )
    export class YourComponent{
    ...
     constructor(tcx: TCX) {}
    .....
    
  2. Initialize tcx service with params, it will use default value if you don't provide params.

        ...
        constructor(tcx: TCX) {
         tcx.init({
          url : '',
          app_id : '',
          secret_key : '',
          public_key : '',
          auth : 'param', // available param, time and none.
          master_key : ''
         });
        }
        ...
    
  3. Available function:

    • getAppID(): string
    • getAppPass(params: any): string
    • getToken(): Observable
    • getRefreshToken(): Observable
    • clearToken()
    • getMasterToken(): string
    • getTime(): string // return tcx_datetime value, but you need to assign it to your parameter (assign it before call getAppPass!).
    • appendTime(params: any): params // return your parameter with tcx_datetime injected (assign it before call getAppPass!).

Note: You need to intercept the http request using HttpInterceptor, don't forget to skip /tcx/authorize and /tcx/reauthorize (url) to prevent infinity loop intercept.

TCX JS also provide Javascript Library, available in this repository TCX JS

Package Sidebar

Install

npm i @verzth/ngx-tcx

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

151 kB

Total Files

26

Last publish

Collaborators

  • silveriusdodi