Hi Preethi,
Did you go through the oauth authorization flow? And are there any errors in the console (or) is the token not substituted in the header?
Thanks,
Raghuram. P
Raghuram, I'm sorry the initial post was not very clear.
I've gone through the OAuth authorisation flow and thus the access_token is available in the .frsh/localstore file.
But then, when I'm trying to use that variable (access_token) in the code, as described in the documentation, I get the following error -
ReferenceError: access_token is not defined
at eval (eval at _.template (/usr/local/lib/node_modules/frsh-sdk/node_modules/underscore/underscore.js:1454:20), <anonymous>:6:9)
at template (/usr/local/lib/node_modules/frsh-sdk/node_modules/underscore/underscore.js:1461:21)
at substituteTemplates (/usr/local/lib/node_modules/frsh-sdk/lib/api/proxy.js:41:59)
at Object.execute (/usr/local/lib/node_modules/frsh-sdk/lib/api/proxy.js:20:18)
at dpRouterExec (/usr/local/lib/node_modules/frsh-sdk/lib/routes/data-pipe.js:6:32)
at Layer.handle eas handle_request] (/usr/local/lib/node_modules/frsh-sdk/node_modules/express/lib/router/layer.js:95:5)
at next (/usr/local/lib/node_modules/frsh-sdk/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/usr/local/lib/node_modules/frsh-sdk/node_modules/express/lib/router/route.js:112:3)
at Layer.handle eas handle_request] (/usr/local/lib/node_modules/frsh-sdk/node_modules/express/lib/router/layer.js:95:5)
at /usr/local/lib/node_modules/frsh-sdk/node_modules/express/lib/router/index.js:281:22
You can look at the code in the OP. Hope this can be resolved ASAP.
Hi Preethi,
We need some more details to debug the issue.
- SDK version
- Node version
- Oauth provider
Adding to it, make sure you have not modified .frsh/localstore file.
Thanks.
The substitution of access_token happens in the server side. We dont let the app read the access_token directly until it is local testing.
Thanks Raghu, Mahesh.
I am now past this. Appreciate your support.