global variables value not passed to functions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 02:02 AM
I have this oauth script. I have declared (this.authCode and this.idToken) as global variables in the initialize function to be used in other functions in this script. Now the problem is that when the "saveToken" function is ran, the value of this.idToken is being read correctly but the this.authCode is empty. What am i missing out here?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 02:06 AM
Hi @cnshum
How are you calling these functions?
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 03:05 AM
The sequence of execution is
1. preprocessAuthCode
2. preprocessAccessToken
3. postprocessAccessToken
4. Savetoken

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 03:50 AM
Hi @cnshum
Please share the script with which you are calling the functions.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 05:36 AM
Hi I don't understand what you mean by script. This is the script. So I am implementing private jet authentication using this oauth API script that I shared in the post.
1. preprocessAuthCode - prepares the request parameters before it is sent to the authorization endpoint
2. preprocessAccessToken - prepares the request parameters before it is send to the token endpoint to exchange for access tokens
3. postprocessAccessToken - retrieves the response from token endpoint ( id_tokens and access tokens are returned here)
4. Savetoken - saves the id_tokens and access tokens