1.0.7 • Published 1 year ago

google-auth-struct v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Google-auth-struct

Build status

Installation and Usage

You can install google-auth-struct in your project's node_modules folder.

To install the latest version on npm locally and save it in your package's package.json file:

npm install google-auth-struct

To use it, just import it in your code:

const { googleAuth } = require("google-auth-struct")

Methods and functions

The googleAuth(token, clientId) function allows you to use Google's authentication service. It takes the token (credential) and the Client ID (available in the 'credentials' tab of the Google Developer Console) as parameters.

Access the Google Dev Console

Use the req.body in your authentication route to get the credential:

const token = req.body.credential

By using the googleAuth() function, it is possible to use methods to help handling user data.

The .getUserData() method returns the user's general information as an object:

await googleAuth(token, clientId).getUserData()

The .getUserName() method returns the user's name as a string:

await googleAuth(token, clientId).getUserName()

The .getUserEmail() method returns the user's email address as a string:

await googleAuth(token, clientId).getUserEmail()

The .getUserPfp() method returns the user's profile picture as a string (URL):

await googleAuth(token, clientId).getUserPfp()

Note

The google-auth-struct NPM has a promise-based structure.

License

Google-auth-struct copyright© 2022-present Bruno Duarte duartebruno581@gmail.com

Google-auth-struct is a free software licensed under the MIT license (LICENSE) file for more details.

1.0.7

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago