@@ -9,7 +9,7 @@ Attribute VB_PredeclaredId = False
99Attribute VB_Exposed = True
1010Implements IAuthenticator
1111''
12- ' Facebook Authenticator v1 .0.0
12+ ' Facebook Authenticator v2 .0.0
1313' (c) Tim Hall - https://github.com/timhall/Excel-REST
1414'
1515' Custom IAuthenticator for Facebook OAuth
@@ -100,25 +100,15 @@ End Property
100100' Public Methods
101101' ============================================= '
102102
103+ ''
104+ ' Setup authenticator
105+ ' --------------------------------------------- '
106+
103107Public Sub Setup (ApplicationId As String , ApplicationSecret As String )
104108 Me.ApplicationId = ApplicationId
105109 Me.ApplicationSecret = ApplicationSecret
106110End Sub
107111
108- Private Sub IAuthenticator_BeforeExecute (Request As RestRequest )
109- Request.AddQuerystringParam "access_token" , Me.Token
110- End Sub
111-
112- Private Sub IAuthenticator_HttpOpen ( _
113- http As MSXML2 .IXMLHTTPRequest, _
114- Request As RestRequest , _
115- BaseUrl As String , _
116- Optional useAsync As Boolean = False )
117-
118- ' Perform standard http open
119- Call http .Open (Request.MethodName(), Request.FullUrl(BaseUrl), useAsync)
120- End Sub
121-
122112Public Sub Login ()
123113 On Error GoTo CleanUp
124114
@@ -179,6 +169,44 @@ End Sub
179169' Private Methods
180170' ============================================= '
181171
172+ ''
173+ ' Hook for taking action before a request is executed
174+ '
175+ ' @param {RestClient} Client The client that is about to execute the request
176+ ' @param {RestRequest} Request The request about to be executed
177+ ' --------------------------------------------- '
178+
179+ Private Sub IAuthenticator_BeforeExecute (ByVal Client As RestClient , ByRef Request As RestRequest )
180+ Request.AddQuerystringParam "access_token" , Me.Token
181+ End Sub
182+
183+ ''
184+ ' Hook for taking action after request has been executed
185+ '
186+ ' @param {RestClient} Client The client that executed request
187+ ' @param {RestRequest} Request The request that was just executed
188+ ' @param {RestResponse} Response to request
189+ ' --------------------------------------------- '
190+
191+ Private Sub IAuthenticator_AfterExecute (ByVal Client As RestClient , ByVal Request As RestRequest , ByRef Response As RestResponse )
192+
193+ End Sub
194+
195+ ''
196+ ' Hook for overriding standard http open (used for HTTP Basic)
197+ '
198+ ' @param {MSXML2.IXMLHTTPRequest} http
199+ ' @parma {RestClient} Client The client that is about to open request
200+ ' @param {RestRequest} Request The request about to be opened
201+ ' @param {String} BaseUrl
202+ ' @param {Boolean} [useAsync=False]
203+ ' --------------------------------------------- '
204+
205+ Private Sub IAuthenticator_HttpOpen (ByRef Http As Object , ByVal Client As RestClient , ByRef Request As RestRequest , BaseUrl As String , Optional UseAsync As Boolean = False )
206+ ' Perform standard http open
207+ Call Http .Open (Request.MethodName(), Request.FullUrl(BaseUrl), UseAsync)
208+ End Sub
209+
182210Private Function TokenRequest () As RestRequest
183211 Set TokenRequest = New RestRequest
184212 TokenRequest.Resource = "oauth/access_token"
0 commit comments