- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 11:54 AM
//authentication type ='basic'/ 'oauth2'
//This line below is optional if you have configured OAuth as authentication type in your outbound REST
r.setAuthentication('oauth2', 'OAuth_Client1');
What is OAuth_Client1 referring to?
I have tried the OAuth Profile name and oauth_entity name, never worked.
Does anyone know?
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 05:27 AM
This is useful thank everyone. But I was looking for the syntax and how to use it. What I found was the UI Action - "Preview Script". But I did not realize this is no longer used in Geneva+. This was to override the security profile setup in the REST method. The issue is in Geneva (maybe Fuji) and above, this is not used anymore. But I found the answer, was hard to find. Here it is:
Old way:
//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthentication(authentication type, profile name);
r.setAuthentication('oauth2', 'OAuth_Client1');
New way:
The new syntax is RESTMessageV2 - setAuthenticationProfile(String type, String profileId)
You can find the details here: RESTMessageV2 - setAuthenticationProfile(String type, String profileId)
Name | Type | Description |
---|---|---|
type | String | The type of authentication profile to use. Valid values are 'basic' to use basic authentication, or 'oauth2' to use OAuth 2.0. |
profileId | String | The sys_id of an authentication profile record. When using basic auth, specify the sys_id of a Basic Auth Configuration [sys_auth_profile_basic] record. When using OAuth 2.0, specify the sys_id of a OAuth Entity Profile [oauth_entity_profile] record. |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 05:27 AM
This is useful thank everyone. But I was looking for the syntax and how to use it. What I found was the UI Action - "Preview Script". But I did not realize this is no longer used in Geneva+. This was to override the security profile setup in the REST method. The issue is in Geneva (maybe Fuji) and above, this is not used anymore. But I found the answer, was hard to find. Here it is:
Old way:
//override authentication profile
//authentication type ='basic'/ 'oauth2'
//r.setAuthentication(authentication type, profile name);
r.setAuthentication('oauth2', 'OAuth_Client1');
New way:
The new syntax is RESTMessageV2 - setAuthenticationProfile(String type, String profileId)
You can find the details here: RESTMessageV2 - setAuthenticationProfile(String type, String profileId)
Name | Type | Description |
---|---|---|
type | String | The type of authentication profile to use. Valid values are 'basic' to use basic authentication, or 'oauth2' to use OAuth 2.0. |
profileId | String | The sys_id of an authentication profile record. When using basic auth, specify the sys_id of a Basic Auth Configuration [sys_auth_profile_basic] record. When using OAuth 2.0, specify the sys_id of a OAuth Entity Profile [oauth_entity_profile] record. |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2017 03:54 PM
Dan,
We are glad you took advantage of the ServiceNow Community to learn more and to get your questions answered. The Customer Experience Team is working hard to ensure that the Community experience is most optimal for our customers.
If you feel that your question was answered, we would greatly appreciate if you could mark the appropriate thread as "Correct Answer". This allows other customers to learn from your thread and improves the ServiceNow Community experience.
If you are viewing this from the Community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thanks,
Shivani Patel