How to access access_token during component execution?


Before we can try to access any part of credentials structure we need to know how it is stored in database. In our database all the credentials are stored in an encrypted conditions. Whenever the process of authorization wants to access a parameter from it, the system is decrypting it in the process and returns the value for further use.

Here is how the credentials are stored in the database:

     "oauth":  {
       "ext_expires_in" : "0",
       "id_token" : "iuyaoixboiayudq807bd209db02ud92jd92",
       "scope" : " calendars.readwrite mail.send",


So for example, if in the component.json it is named like oauth then it will be stored under that name. For obvious reasons we did not include a real data in the above example but the structure of stored data is the same.

It is entierly up to the component developer how to name that particular section in the component.json. It can be myOauth or something else. The system will use that exact name (myOauth) to store the structure in the database.

To access, and modify values they would need to be addressed accordingly like credentials.oauth.access_token or through any other name the structure was called. For example in case if it was called myOauth then using something like this credentials.myOauth.access_token.

Credentials field name

The name of the credentials field inside the component.json is used to access OAuth data during the component execution. If for example the field was set to be myOAuth inside the component.json then the credentials would be like:

     "myOAuth":  {