Visual FoxPro
Visual FoxPro
Clear REST Authentication Settings
See more REST Examples
Demonstrates Rest.ClearAuth, which removes any authentication providers and credentials previously configured through the SetAuth* methods.
Background. Clearing authentication is useful when reusing a Rest object for a request that must be sent without credentials, or before switching to a different authentication method.
Chilkat Visual FoxPro Downloads
LOCAL lnSuccess
LOCAL loRest
LOCAL lnBTls
LOCAL lnBAutoReconnect
LOCAL lcUsername
LOCAL lcPassword
lnSuccess = 0
loRest = CreateObject('Chilkat.Rest')
lnBTls = 1
lnBAutoReconnect = 1
lnSuccess = loRest.Connect("example.com",443,lnBTls,lnBAutoReconnect)
IF (lnSuccess = 0) THEN
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
* Normally you would not hard-code secrets in source. You should instead obtain them from an
* interactive prompt, environment variable, or a secrets vault.
lcUsername = "myUsername"
lcPassword = "myPassword"
lnSuccess = loRest.SetAuthBasic(lcUsername,lcPassword)
IF (lnSuccess = 0) THEN
? loRest.LastErrorText
RELEASE loRest
CANCEL
ENDIF
* ClearAuth removes any authentication providers and credentials previously configured through the
* SetAuth* methods, for example before reusing the object for an unauthenticated request.
loRest.ClearAuth()
? "Authentication cleared."
RELEASE loRest