4D Blog

Home Product 4D Netkit: Get user information from Google

4D Netkit: Get user information from Google

January 22, 2025

Product

Being able to access Google user information efficiently is critical for creating responsive user interfaces and automating tasks like sending emails to multiple users within a domain. To meet these requirements, we have introduced a set of features to get specific user information and to retrieve all domain profiles and contacts.

Account connection

Before getting user information, we need to create an OAuth 2.0 connection object:

var $oAuth2:=cs.NetKit.OAuth2Provider.new($credentials)
var $google:=cs.NetKit.Google.new($oAuth2)

Note that multiple scopes may be required to access the user’s information:

  • https://www.googleapis.com/auth/contacts
  • https://www.googleapis.com/auth/contacts.other.readonly
  • https://www.googleapis.com/auth/contacts.readonly
  • https://www.googleapis.com/auth/directory.readonly
  • https://www.googleapis.com/auth/user.addresses.read
  • https://www.googleapis.com/auth/user.birthday.read
  • https://www.googleapis.com/auth/user.emails.read
  • https://www.googleapis.com/auth/user.gender.read
  • https://www.googleapis.com/auth/user.organization.read
  • https://www.googleapis.com/auth/user.phonenumbers.read
  • https://www.googleapis.com/auth/userinfo.email
  • https://www.googleapis.com/auth/userinfo.profile

Fetch Current User Details

The ability to pull information about the currently authenticated user has been added: Google.user.getCurrent(). By default, this returns key details like the user’s name and email address but can be extended to include other attributes such as phone numbers, birthdays, and more.

var $currentUser :=$google.user.getCurrent()

Retrieve All Domain Profiles and Contacts

The Google.user.list() command allows developers to access directory profiles or domain contacts. It includes options for filtering and paginating results to suit different application needs.

var $userList :=$google.user.list()

Get Specific User Information

The Google.user.get() command provides information about a specific person by using their resource name. Developers can specify which data fields to retrieve using a field mask, allowing for efficient data handling.

var $user :=$google.user.get($userList.users[0].resourceName)

Conclusion

These new features empower 4D developers with the tools needed to retrieve Google user information. Whether you’re working on enhancing the user interface or automating emails, having easy access to user data is key to building better applications.

Discuss

Tags 20 R8, 21, 4D NetKit, Google

Latest related posts

  • February 3, 2026

    4D Write Pro – Adding a margin automatically when bullets are set using standard actions

  • January 22, 2026

    Transform Static Documents into Actionable Knowledge with AIKit

  • January 22, 2026

    Deploy Fluent UI effortlessly in your 4D applications

Fabrice Mainguené
Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • Release infos
  • 4D View Pro
  • 4D Write Pro
  • Email, Microsoft 365, Gmail
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • 4D Qodly Pro
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Google Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy