Best Approach to Handle and Store OAuth Authorization Code in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 09:51 PM
Hello everyone,
I am currently working on integrating ServiceNow with LinkedIn. As part of the OAuth 2.0 authorization flow, after users successfully authorize the integration, I receive an authorization code in the URL, like this:
https://dev203650.service-now.com/oauth_redirect.do?code=AQR_WjTIXSyvTCy8Aa1dKJRHBY0WB8RiWezj03AESdnLtrmtW5I4eTr_pNzqHduw-Qfb8c4cE4tdJhqeb3O7-7fR0eMYFfEmklHmlKYbimmg4YC0p_JlS4AaHkVYnXKu8lWl8W_mjew-JD45gLA1JyEdQZhpEwz-h7FJBmQfrEJ6i4DUo7mhJy3fOmTk3G6St0J_puLG4HDOEyT_SZ0
I would like to understand the best approach to handle and store this authorization code in ServiceNow for obtaining access tokens for multiple users. Specifically, I am looking for guidance on how to capture the code from the redirect URL and securely store it in ServiceNow for further processing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 10:12 PM
HI @Pooja_29 ,
Best way to do is to store it in property.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 10:47 PM
Hi @Runjay Patel ,
Can you explain in detail how I can store this code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 10:57 PM
Hi @Pooja_29 ,
Create a property to store the same and use
gs.setProperty('property_name', 'property_value');
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 05:36 AM
Hi @Runjay Patel,
Actually, the authorization in this URL is dynamic and changes continuously