coldfusion - Google Calendar API V3 Refresh Token Confusion -


i using cfc google calendar v3 api billeatman. have integrated in pages, go login , authenticate , start working. trouble starts when authentication expires, when session still active in website.

i tried storing structure returned google api along access_token , refresh_token in database table. after storing, confused. how call it? above git code says this:

<cfset application.oauth2.refreshtoken() /> 

the function has following code:

<cffunction name="refreshtoken" access="public" output="false" hint="i take refresh_token authorization procedure , new access token.">     <cfset var strurl = base_auth_endpoint & "token">     <cfhttp url="#strurl#" method="post">         <cfhttpparam name="client_id" type="formfield" value="#variables.client_id#">         <cfhttpparam name="client_secret" type="formfield" value="#variables.client_secret#">         <cfhttpparam name="refresh_token" type="formfield" value="#gettokenstruct().refresh_token#">         <cfhttpparam name="grant_type" type="formfield" value="refresh_token">     </cfhttp>     <cfreturn manageresponse(cfhttp.filecontent)> </cffunction> 

but lost how pass token stored in database refreshtoken. tried is, calling following 2 functions:

<cfset application.oauth2.setrefresh_token('#getaccess.refreshtoken#')> <cfset application.oauth2.setaccess_token('#getaccess.accesstoken#')>  

an error thrown @ section:

<cfset application.oauth2.setaccess_token('#getaccess.accesstoken#')> 

it says "method not found in cfc". lost. how keep oauth2 alive google calendar, until logged out.

<cffunction name="setaccess_token" access="private" output="false" hint="setter oauth access_token">    <cfargument name="access_token" type="string" required="true">    <cfset gettokenstruct()['access_token'] = arguments.access_token> </cffunction>  <cffunction name="setrefresh_token" access="public" output="true" hint="setter oauth refresh_token">    <cfargument name="refresh_token" type="string" required="true">    <cfset gettokenstruct()['refresh_token'] = arguments.refresh_token> </cffunction> 

the message, "method not found in cfc" because calling private function, setaccess_token, outside of cfc. access="private" means function cannot called outside cfc, because scope private component. change function access access="public" , can call are: componentpath.publicfunction()


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -