PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
New WINDEV, WEBDEV and WINDEV Mobile 26 feature!
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Refreshes a user's OAuth2 token when it expires.
Example
gToken is AuthToken
 
// Get a token
OAuth2Params is OAuth2Parameters
OAuth2Params.ClientID = "1060349503186-pc7ahmeb6h6mc3jd19nlva26kt7gk59q.apps.googleusercontent.com"
OAuth2Params.ClientSecret = "oBTQL52JiT82Wmuy9-76MpiM"
OAuth2Params.AuthURL = "https://accounts.google.com/o/oauth2/v2/auth"
OAuth2Params.TokenURL = "https://www.googleapis.com/oauth2/v4/token"
OAuth2Params.Scope = "email profile openid"
OAuth2Params.RedirectionURL = "http://localhost:9846"
 
// Ask for authentication: opens the login window
gToken = AuthIdentify(OAuth2Params)
 
IF NOT gToken.Valid THEN
IF ErrorOccurred THEN
Info(ErrorInfo(errFullDetails))
ELSE
Info("Authentication error")
END
RETURN
END
 
MyIdentity is OpenIDIdentity = OpenIDReadIdentity(gToken)
 
Trace("Token = " + gToken.Value + CR + "Expiration date = " + ...
DateTimeToString(gToken.ExpirationDate) + CR + "RefreshToken = " + ...
gToken.Refresh + CR + CR + MyIdentity.Email)
 
// Refresh token
 
gToken = AuthRefreshToken(gToken)
 
IF NOT gToken.Valid THEN
IF ErrorOccurred THEN
Info(ErrorInfo(errFullDetails))
ELSE
Info("Error")
END
RETURN
END
 
Trace("Token = " + gToken.Value + CR + "Expiration date = " + ...
DateTimeToString(gToken.ExpirationDate) + CR + ...
"RefreshToken = " + gToken.Refresh)
Syntax
<Result> = AuthRefreshToken(<Token>)
<Result>: AuthToken variable
AuthToken variable that corresponds to the refreshed token.
<Token>: AuthToken variable
Name of the AuthToken variable that corresponds to the token to be refreshed. This token is returned by AuthIdentify, for example.
Remarks
Some tokens cannot be refreshed. The Refresh property of the AuthToken variable can be used to determine if the token can be refreshed.
Component: wd260ggl.dll
Minimum version required
  • Version 26
This page is also available for…
Comments
Click [Add] to post a comment