Skip to content

Commit 82fcdd3

Browse files
authored
Create getSubscriptionKey.js
This BG script will be helpful to fetch the subscription key for any API to view key value if forget, store and update if required for doc purpose This will use GlideEncrypter and Decrypted API
1 parent 01bb3d8 commit 82fcdd3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
This BG script will be helpful to fetch the subscription key for any API to view key value if forget, store and update if required for doc purpose
3+
4+
This will use GlideEncrypter and Decrypter API
5+
*/
6+
var gr = new GlideRecord('api_key_credentials');
7+
gr.addQuery('name', ' <ENter your Key Name for ex MSFT subscription Key>'); // Replace with your credential name
8+
gr.query();
9+
if (gr.next()) {
10+
var encryptedApiKey = gr.api_key; // Assuming 'api_key' is the field name
11+
var decryptedApiKey = new GlideEncrypter().decrypt(encryptedApiKey);
12+
gs.info("Decrypted API Key: " + decryptedApiKey);
13+
}

0 commit comments

Comments
 (0)