GlideEncrypter is not allowed in scoped applications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2016 02:58 PM
GlideEncrypter is not allowed in scoped applications.How can i access the function in scoped application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2024 01:54 AM - edited 09-02-2024 01:57 AM
This doesn't work when password is in global scope (shared by many apps).
(function execute() {
var credential = new GlideRecord('basic_auth_credentials');
credential.get('name', 'ADO - Pipeline');
const pat = credential.password.getDecryptedValue();
var token = GlideStringUtil.base64Encode(':'+pat).toString();
gs.log("Token: " + token);
})();
This is the error
Works perfectly fine when run in globla scope and I've no idea how to grant it the appropriate scope access because documentation is hard if not impossible to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2021 07:37 AM
The code in the previous reply did not work for me, however, there is a ScopedEncrypter class available for scoped apps (it's a Script Include!).
In my app, I used the code below:
var encryptedSecret = "<your encrypted secret goes here>";
var decryptedSecret = new global.ScopedEncrypter().decrypt(encryptedSecret);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-07-2022 12:48 PM
Best post ever
Kind Regards
Ashley
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2023 02:32 AM
For those that want to know more about this script include but can't just install the plugin, here is some more information:
Name: ScopedEncrypter
Description: Utility to be used in integration hub spokes where there is a need to encrypt/decrypt the tokens/keys to be used in the REST request
It's a Global Script include that is accessible from other scopes. And the gist is simply that it calls the global new GlideEncrypter function. I'm not sure if I'm allowed by ServiceNow to just copy-paste the code so I suggest creating the script include yourself with this information. 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-30-2023 12:40 PM
This is absolutely correct. Thanks David.