Skip to content

Commit 7ecc1e9

Browse files
committed
updated error reporting
1 parent a43a7fa commit 7ecc1e9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

packages/security/GoogleUserDirectory.cfc

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,16 @@
212212

213213
<cfset var cfhttp = structnew() />
214214
<cfset var stResult = structnew() />
215-
<cfset var stProxy = parseProxy(arguments.proxy) />
215+
<cfset var stAttr = structnew() />
216+
217+
<cfset stAttr.url = "https://accounts.google.com/o/oauth2/token" />
218+
<cfset stAttr.method = "POST" />
219+
220+
<cfif len(arguments.proxy)>
221+
<cfset structappend(stAttr,parseProxy(arguments.proxy)) />
222+
</cfif>
216223

217-
<cfhttp url="https://accounts.google.com/o/oauth2/token" method="POST" attributeCollection="#stProxy#">
224+
<cfhttp attributeCollection="#stAttr#">
218225
<cfhttpparam type="formfield" name="code" value="#arguments.authorizationCode#" />
219226
<cfhttpparam type="formfield" name="client_id" value="#arguments.clientID#" />
220227
<cfhttpparam type="formfield" name="client_secret" value="#arguments.clientSecret#" />
@@ -223,7 +230,7 @@
223230
</cfhttp>
224231

225232
<cfif not cfhttp.statuscode eq "200 OK">
226-
<cfset throwError(message="Error accessing Google API: #cfhttp.statuscode#",endpoint="https://accounts.google.com/o/oauth2/token",response=cfhttp.filecontent,argumentCollection=arguments) />
233+
<cfset throwError(message="Error accessing Google API: #cfhttp.statuscode#",endpoint="https://accounts.google.com/o/oauth2/token",response=trim(cfhttp.filecontent),args=arguments,stAttr=stAttr) />
227234
</cfif>
228235

229236
<cfset stResult = deserializeJSON(cfhttp.FileContent.toString()) />
@@ -327,7 +334,7 @@
327334

328335
<cfset application.fc.lib.error.logData(stLog,false,false) />
329336

330-
<cfthrow message="#arguments.message#" />
337+
<cfthrow message="#arguments.message#" detail="#serializeJSON(arguments)#" />
331338
</cffunction>
332339

333340
</cfcomponent>

0 commit comments

Comments
 (0)