@toolmate/plugin-google
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Toolmate Google Plugin

npm version

The plugin provides your toolmate-based editor with google auth functionality. When calling getAccessToken() from Toolmate the user will get a window with authorization via google.

Setup

In your toolmate-based editor install the plugin:

npm i @toolmate/plugin-google

add it into Toolmate:

import { addPlugin } from '@toolmate/core'
import { getGooglePlugin } from '@toolmate/plugin-google'

const GOOGLE_PROJECT_CLIENT_ID = 'XXX' // Client ID of a google project that you should create in Google Cloud Console. Your users will be authenticating via this project.

addPlugin(getGooglePlugin(GOOGLE_PROJECT_CLIENT_ID))

use in the code:

import { getAccessToken } from '@toolmate/core'

const accessToken = await getAccessToken('google-auth', { scope: ['email'] })
// Use this accessToken to access google services, your own API etc.

Feel free to call getAccessToken() as many times as you want at any moment with any scope you need (even if it's different every time) - the plugin will try to handle it in the smartest way and just resolve the promise.

Dependents (0)

Package Sidebar

Install

npm i @toolmate/plugin-google

Weekly Downloads

2

Version

0.1.0

License

MIT

Unpacked Size

8.54 kB

Total Files

6

Last publish

Collaborators

  • anvoevodin