🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

google-api-javascript-client

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-api-javascript-client

A NPM package for Google API JavaScript Client: https://github.com/google/google-api-javascript-client

0.1.0
latest
Version published
Weekly downloads
182
-9.9%
Maintainers
1
Weekly downloads
 
Created

google-api-javascript-client

NPM version

This is a simple NPM wrapper around the Google API Javascript Client, which is not published to NPM. This package also includes the TypeScript definitions for the client.

Install

npm install google-api-javascript-client

Usage

import { gapi, load } from "google-api-javascript-client";
// Or
const { gapi, load } = require("google-api-javascript-client");

async function fn() {
    // 1. Load the JavaScript client library.
    await load('client')
    
    // 2. Initialize the JavaScript client library.
    await gapi.client.init({
        'apiKey': 'YOUR_API_KEY',
        // clientId and scope are optional if auth is not required.
        'clientId': 'YOUR_WEB_CLIENT_ID.apps.googleusercontent.com',
        'scope': 'profile',
    })

    // 3. Initialize and make the API request.
    const response = await gapi.client.request({
        'path': 'https://people.googleapis.com/v1/people/me?requestMask.includeField=person.names',
    })
    console.log(response.result);
}

License

MIT

FAQs

Package last updated on 10 Oct 2023

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