Need to setup Authentication for Scripted REST API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Everyone,
I am new to integration, I have created a scripted REST API(GET) to send some CMDB field details in JSON format, It is working fine when tested using REST API Explorer, Now the next we need to setup authentication. Client have provided service account user (username and password) which has cmdb_read role.
Please guide me how can I setup this authentication in scripted REST API. Do i need to created ACL of type REST_End type and provide the role as cmdb_read and use this ACL in scripted Rest API. Also How can i test this using Postman?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
are you using correct credentials?
try to create ACL on oauth_credential table so that the API user can generate token
User unable to get an OAuth 2.0 access token
Non-admin users cannot retrieve OAuth token from OAuth Credentials table to make outbound REST call
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar Yes II am using credentials they have shared even tried to setup new password and tried but everytime I am getting authentication error. Should I created new user for web service enabled and provide the role rest_service, cmdb_read and rest_api_explorer and test with new user?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar , I got the root cause of failing the basic auth, actually the user which client had provided was created through LDAP/SSO and password does not get stored locally in ServiceNow, Maybe that is why Postman was unable to validate this user.
To fix this I created a local user and tested with that and getting the response from Postman.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Glad to know.
I already informed the new API user you create should have those 2 checkboxes true so that it bypasses the SSO as it's integration user
Please mark my response as correct and close the thread
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
