Previous Topic

Next Topic

Book Contents

Book Index

EnsureRefreshToken - MaxBasic Function

EnsureRefreshToken(Provider: string, User: string [, ExpiryWithinDays: Number]) :Boolean

EnsureRefreshToken function returns True if RefreshToken will not expire within the number of days given, False otherwise.

If a refresh token will expire within ExpiryWithinDays days, then an authentication prompt will be presented to the user to complete login. The function will only return once this information has been entered.

In all cases, we will assume RefreshTokens expire within 90 days of being first issued (which is currently the case for MS JWT tokens).

EnsureRefreshToken function syntax has these named arguments:

Parameter

Description

Provider

Required. The Token provider.
Values are

  • "O" - Office 365
  • "P" - MS Graph

User

Required. The User Code to Ensure Refresh Token for.

Expiry Within Days

Optional. Number of days to check the refresh token will not expire for.

If ExpirywithinDays is not specified, then the logic for expiry will change to "expired if more than 67.5 days (75% of 90) have passed since first issued.

Sample usage:

msgbox(EnsureRefreshToken("P", "DEMO", 3))