v2026.6.4
All Bundles
Bundle OAuth client (-lib net_server)

OAuthToken

OAuth token

Operations

FormatNewToken # function

Formats a new token

function : FormatNewToken(access_token:String, expires_in:Int) ~ String

Parameters

NameTypeDescription
access_tokenStringaccess token
expires_inIntexpiration time

Return

TypeDescription
Stringformatted token string

GetAccessToken #

Get access token

method : public : GetAccessToken() ~ String

Return

TypeDescription
Stringaccess token

GetExpiresIn #

Get expiration time

method : public : GetExpiresIn() ~ Int

Return

TypeDescription
Intexpiration time

GetRefreshToken #

Get refresh token

method : public : GetRefreshToken() ~ String

Return

TypeDescription
Stringrefresh token

GetScope #

Get scope

method : public : GetScope() ~ String

Return

TypeDescription
Stringscope

IsExpired #

Returns true if the access token has expired

method : public : IsExpired() ~ Bool

Return

TypeDescription
Booltrue if expired, false otherwise

New # constructor

Constructor

New(access_token:String, refresh_token:String, expires_in:Int, scope:String)

Parameters

NameTypeDescription
access_tokenStringaccess token
refresh_tokenStringrefresh token
expires_inIntexpiration time
scopeStringtoken scope

ReadTokenFormat # function

Reads and validates token format

function : ReadTokenFormat(secret_str:String) ~ String

Parameters

NameTypeDescription
secret_strStringsecret string

Return

TypeDescription
Stringtoken if valid, Nil otherwise

Set #

Sets the token values

method : public : Set(access_token:String, expires_in:Int, scope:String) ~ Nil

Parameters

NameTypeDescription
access_tokenStringaccess token
expires_inIntexpiration time
scopeStringtoken scope

ToString #

Get token as string

method : public : ToString() ~ String

Return

TypeDescription
Stringtoken as string

Example

scopes := ["https://www.googleapis.com/auth/drive"];
client := System.IO.Net.OAuth.OAuthClient->New("client_secret.json", scopes);
token := client->GetToken();
if(token <> Nil) {
  token->ToString()->PrintLine();
};