VBAuth – Shared Modules #
This folder contains the .BAS modules that must be added to any VBA installation that will use VBAuth.DLL
v2, for VBAuth 1.0.0.3
1. Module to handle JSON blobs #
- JSONConverter.bas
- VBA-JSON v2.3.1 by Tim Hall (MIT License)
- Source: https://github.com/VBA-tools/VBA-JSON
- If your project already contains VBA-JSON, do not import a second copy. The two
would both declareParseJson,ConvertToJson,ParseUtc,ConvertToUtc,ParseIso
andConvertToIso, and the project will not compile. Use the copy you have — this one
differs only in minor changes made to integrate with VBAuth.DLL. - Included in this project for JSON parsing in VBA
- Minor modifications made to integrate with VBAuth.DLL
2. Module to obtain Graph API bearer token #
- modVBAuthGlobalConstants.bas
- this contains both global constants and these functions to use VBAuth.dll:
- SetEntraAPPIdValues
- AcquireBearerToken
- ClearTokenCache
- NormaliseScopeClaims
- FindSharedRegistration
- GetVBAuthLogPath
- IsValidGUID
- validate and manipulate scopes
- it also implements a five-step in-memory token cache, switched on by three
Public Booleans which all default to False:blnCheckExistingToken— reuse the token already in handblnUseRowCache— reuse this AppID’s own cached tokenblnUseFullCache— reuse another AppID’s cached token on the same registration
- set these in your own startup code; until you do, every call signs in afresh
- see the VBAuth Upgrade Guide for the detail
3. (Optional) module to validate the Graph API working environment #
- modVBAuthTesting.bas
- this contains code to ensure VBAuth.dll is correctly installed and has a valid licence:
- CheckDependencies — are the required DLLs present
- CheckPresenceOfLicenceFiles — do the .LIC files exist beside the DLL
- CheckLicence — are those files valid for this tenant
- GetVBAuthFolder — where the loaded DLL reports it lives
- each has a
Test_wrapper that shows the answer in a message box, for running from the
Immediate Window
4. Access Query #
- Create the local admin table – run this script in this document once in your database to create the
lclVBAuthAdmintable.
5. Names this module declares #
modVBAuthGlobalConstants is a globals module. Importing it brings 22 Public variables,
one Public constant and one API declaration into your project, as well as the functions
above. Several use common names, so if your database already declares any of these you
will get “Ambiguous name detected” on compile and must rename one of the two:
db, strSQL, strMessage, blnResult, Sleep, PORTAL_URL
The rest are prefixed and unlikely to clash: intAppID, strClientID, strTenantID,
strScopeRequested, strBearerToken, datBearerExpiry, strGraphAPI_Verb,
strGraphAPI_URL, lngHTTPTimeout, strCachedClaims, strCachedClientID,
strCachedTenantID, strTokenSource, intTokenSourceAppID, rsAPIData, plus the three
caching Booleans above.
db, strSQL and rsAPIData are scratch working variables used by
SetEntraAPPIdValues, which closes and releases them before it returns. Nothing should
rely on them surviving a call.
VBAuth, developed and maintained by Andrew Richards (The IT Service Ltd) and Peter Bryant (Corylus Business Systems), © 2025–2026. All rights reserved. https://vbauth.com