Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gat-solutions/google-auth

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gat-solutions/google-auth

Đây là một thư viện hỗ trợ gọi API Google Auth. Thư viện bao gồm 1 service gọi API đi kèm những định nghĩa type dành cho typescript.

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

E-commerce Integration

Introduction

Đây là một thư viện hỗ trợ gọi API Google Auth. Thư viện bao gồm 1 service gọi API đi kèm những định nghĩa type dành cho typescript.

Installation

$ npm install @gat-solutions/google-auth

Config environment

CLIENT_EMAIL=
PRIVATE_KEY=
PROJECT_ID=

EcommerceService

Muốn kết nối được với service Google Auth bạn cần có 3 key ở trên. Sau đó dùng hàm dưới đây để lấy access token.

...
    import { configs } from "../configs";
    const googleAuthHelper = new GoogleAuthHelper({
        clientEmail: "CLIENT_EMAIL",
        privateKey: "PRIVATE_KEY",
        projectId: "PROJECT_ID",
    });
...
...
    const { token } = await googleAuthHelper.getTokenResponse();
...

getConfig

Lấy cấu hình

...
    import { ConfigGoogleAuth } from "@gat-solutions/google-auth";


    const { token } = await googleAuthHelper.getTokenResponse();
    const config : ConfigGoogleAuth = await googleAuthHelper.getConfig(token)
...

insertConfigAuthorizedDomains

Thêm tên miền vào AuthorizedDomains của cấu hình

...
    import { ConfigGoogleAuth } from "@gat-solutions/google-auth";


    const { token } = await googleAuthHelper.getTokenResponse();

    const newDomain = "example.com"
    const config : ConfigGoogleAuth = await googleAuthHelper.insertConfigAuthorizedDomains(newDomain, token);
...

removeConfigAuthorizedDomains

Xóa tên miền ra khỏi AuthorizedDomains của cấu hình

...
   import { ConfigGoogleAuth } from "@gat-solutions/google-auth";


    const { token } = await googleAuthHelper.getTokenResponse();

    const domainRemove = "example.com"
    const config : ConfigGoogleAuth = await googleAuthHelper.removeConfigAuthorizedDomains(newDomain, token);
...

Keywords

FAQs

Package last updated on 20 Aug 2024

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