Options
All
  • Public
  • Public/Protected
  • All
Menu

The CSCheckin authentication manager.

Hierarchy

  • default

Index

Constructors

constructor

  • new default(gIdToken: string, gAccessToken: string): default
  • Construct this manager.

    Parameters

    • gIdToken: string

      The ID token received from Google.

    • gAccessToken: string

      The access token received from Google.

    Returns default

Properties

Private accessData

accessData: null | { access_token: string; exp: number; token_type: string; user: { student?: { number: string; class: string; } | undefined; id: number; google_user_id: string; domain: string; name: string; email: string; photo: string; created_at: string; updated_at: string; } } = null

Methods

export

  • export(): string
  • Export the credential to JSON-serialized CSCAuthExportStructure.

    Returns string

    JSON-serialized CSCAuthExportStructure

getAccessData

  • getAccessData(): Promise<{ access_token: string; exp: number; token_type: string; user: { student?: { number: string; class: string; } | undefined; id: number; google_user_id: string; domain: string; name: string; email: string; photo: string; created_at: string; updated_at: string; } }>
  • Get the credential including token and user information.

    Returns Promise<{ access_token: string; exp: number; token_type: string; user: { student?: { number: string; class: string; } | undefined; id: number; google_user_id: string; domain: string; name: string; email: string; photo: string; created_at: string; updated_at: string; } }>

getAuthenticationHeader

  • getAuthenticationHeader(): Promise<string>
  • Get the authentication header that can use for directly requesting API.

    Returns Promise<string>

revoke

  • revoke(): Promise<boolean>
  • Revoke this access token.

    Returns Promise<boolean>

setIdentity

  • setIdentity(userClass: string, userNo: string): Promise<boolean>
  • Set the student class and no.

    Parameters

    • userClass: string

      The student class.

    • userNo: string

      The student no.

    Returns Promise<boolean>

userInfo

  • userInfo(): Promise<{ created_at: string; domain: string; email: string; google_user_id: string; id: number; name: string; photo: string; student: undefined | { number: string; class: string; }; updated_at: string }>
  • Get the user information.

    The response of this API won't be cached!

    Returns Promise<{ created_at: string; domain: string; email: string; google_user_id: string; id: number; name: string; photo: string; student: undefined | { number: string; class: string; }; updated_at: string }>

Static import

  • Import the credential from JSON-serialized CSCAuthExportStructure.

    Parameters

    • data: string

      the JSON-serialized data from CSCAuth.export().

    Returns default

Generated using TypeDoc