- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 508
Authentication
        Tim Hall edited this page Jan 16, 2015 
        ·
        3 revisions
      
    VBA-Web comes with a few authenticators out-of-the-box and you can create your own
(Make sure the desired authenticator class is included in the project)
Dim Client As New WebClient
' Create a new IAuthenticator implementation
Dim Auth As New ...Authenticator
' Setup authenticator...
' Attach the authenticator to the client
Set Client.Authenticator = AuthThis is the standard Username + Password flow.
Note: The Username and Password are encoded, but not encrypted so https must be used when accessing services for the transmission to be secure
Dim Auth As New HttpBasicAuthenticator
Auth.Setup _
    Username:="Your username", _
    Password:="Your password"This is the standard OAuth 1.0 flow, using a Consumer key and secret, and Token key and secret to authorize requests.
Dim Auth As new OAuth1Authenticator
Auth.Setup _
    ConsumerKey:="Your consumer key", _
    ConsumerSecret:="Your consumer secret", _
    Token:="Your token", _
    TokenSecret:="Your token secret", _
    Realm:="Optional realm"Currently VBA-Web supports only the client-credentials flow of OAuth 2.0.
Notes:
- This authenticator was developed specifically for Salesforce implementation, so it may not be compatible with other APIs that implement OAuth 2.0.
- The Username and Password are encoded, but not encrypted so https must be used when accessing services for the transmission to be secure
Dim Auth As new OAuth2Authenticator
Auth.Setup _
    ClientId:="Your client id", _
    ClientSecret:="Your client secret", _
    Username:="Your username", _
    Password:="Your password"Can't find an authenticator that meets your needs? Create your own! Check out the Implementing your own IAuthenticator example for details.