Socket
Socket
Sign inDemoInstall

@types/gapi.auth2

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/gapi.auth2

Type definitions for Google Sign-In API from https://www.github.com/DefinitelyTyped/DefinitelyTyped


Version published
Weekly downloads
153K
decreased by-18.23%
Maintainers
1
Weekly downloads
 
Created

What is @types/gapi.auth2?

@types/gapi.auth2 provides TypeScript definitions for the Google API Client Library for JavaScript (gapi.auth2). This package allows developers to use TypeScript to interact with Google's OAuth 2.0 authentication system, enabling functionalities such as user sign-in, sign-out, and managing user sessions.

What are @types/gapi.auth2's main functionalities?

Initialize the Google Auth instance

This feature allows you to initialize the Google Auth instance with your client ID and the required scopes. This is the first step in setting up Google authentication in your application.

const auth2 = gapi.auth2.init({
  client_id: 'YOUR_CLIENT_ID.apps.googleusercontent.com',
  scope: 'profile email'
});

Sign in a user

This feature allows you to sign in a user using Google's OAuth 2.0. The code sample demonstrates how to sign in a user and log their basic profile information.

auth2.signIn().then(user => {
  console.log('User signed in:', user.getBasicProfile().getName());
});

Sign out a user

This feature allows you to sign out a user from your application. The code sample demonstrates how to sign out a user and log a confirmation message.

auth2.signOut().then(() => {
  console.log('User signed out');
});

Check if a user is signed in

This feature allows you to check if a user is currently signed in. The code sample demonstrates how to check the sign-in status and log it.

const isSignedIn = auth2.isSignedIn.get();
console.log('Is user signed in?', isSignedIn);

Other packages similar to @types/gapi.auth2

FAQs

Package last updated on 19 May 2016

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