---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# AuthCredential - スコープ指定

# AuthCredential - スコープ指定 {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：6分

AuthCredential() API は、REST 要求の認証情報をビルドできるメソッドを提供します。  
これらの API を次の順序で使用して、送信署名要求を生成します。

1. HttpRequestData:API 要求をビルドします。
2. AuthCredential:認証情報オブジェクトを作成するか、既存の認証情報オブジェクトを更新します。認証情報を使用して、 RequestAuthAPI クラスを介して要求に署名します。
3. RequestAuthAPI:要求に署名し、HttpRequestAuthedData オブジェクトを返します。
4. HttpRequestAuthedData:署名された要求に関する情報を取得します。
5. GlideHTTPRequest:署名された要求を送信します。
{#AuthCredentialAPI__ol_gvv_22t_tjb}

これらの API を使用する前に、要求に署名する [認証アルゴリズムを構成](https://www.servicenow.com/docs/access?context=configure-authentication-algorithm&version=australia&pubname=australia-platform-security&ft:locale=en-US) し、要求の認証に使用する認証情報に関連付ける必要があります。

空の AuthCredential オブジェクトを作成したり、既存の AuthCredential オブジェクトをインスタンス化したり、 StandardCredentialsProvider クラスを使用して、認証情報 \[discovery_credentials\] テーブルの認証情報レコードを使用して AuthCredential オブジェクトをインスタンス化したりできます。空の AuthCredential オブジェクトを作成する場合は、 setAttribute() メソッドを使用してオブジェクトにプロパティを追加します。 {#AuthCredentialAPI__p_mpf_pjx_zjb}  
次の例は、 StandardCredentialsProvider を使用して AuthCredential をインスタンス化する方法を示しています。

    // Return an AuthCredential object using a Credential sys_id
    var credential = new sn_cc.StandardCredentialsProvider().getAuthCredentialByID("5b61c16f73533300f662cff8faf6a74b");

名前空間識別子が`sn_auth`スコープ対象のスクリプトで AuthCredential API を使用します。

## AuthCredential:AuthCredential(オブジェクト authCredential) {#ariaid-title2}

新しい AuthCredential オブジェクトをインスタンス化するか、既存の AuthCredential オブジェクトを変更します。
空の AuthCredential オブジェクトを作成したり、既存の AuthCredential オブジェクトをインスタンス化したり、 StandardCredentialsProvider クラスを使用して、認証情報 \[discovery_credentials\] テーブルの認証情報レコードを使用して AuthCredential オブジェクトをインスタンス化したりできます。空の AuthCredential オブジェクトを作成する場合は、 setAttribute() メソッドを使用してオブジェクトにプロパティを追加します。
{#AuthCredential-AuthCredential_O__table_sjv_2sx_5jb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| 認証情報 | オブジェクト | オプション。既存の AuthCredential オブジェクトを更新するには、このパラメーターを含めます。 |
[表 : 1. パラメーター]

{#AuthCredential-AuthCredential_O__table_sjv_2sx_5jb}

## 認証情報:getAttribute(文字列キー) {#ariaid-title3}

AuthCredential 属性の値を返します。
{#AuthCredential-getAttribute_S__table_ss5_hsx_5jb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| key | 文字列 | 値を返す属性のキー。 空の AuthCredential オブジェクトを作成した場合は、 setAttribute() メソッドを使用してオブジェクトにプロパティを追加する必要があります。 認証情報レコードを使用して AuthCredential オブジェクトをインスタンス化した場合は、認証情報 \[discovery_credentials\] テーブルからフィールド名を渡して値にアクセスします。 |
[表 : 2. パラメーター]

{#AuthCredential-getAttribute_S__table_ss5_hsx_5jb} {#AuthCredential-getAttribute_S__table_ts5_hsx_5jb__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 3. 返される内容]

{#AuthCredential-getAttribute_S__table_ts5_hsx_5jb}  

    // Define the HttpRequestData object
    var endpoint= "https://third-party-endpoint";
    var httpRequestData = new sn_auth.HttpRequestData();
    httpRequestData.setEndpoint(endpoint);
    httpRequestData.setService('s3');
    httpRequestData.setRegion('us-east-1');
    httpRequestData.setHttpMethod("PUT");
    var content = "Action=SendMessage&MessageBody=This is a test message";
    httpRequestData.setContent(content);
    httpRequestData.addHeader('x-amz-acl', 'public-read' );
     
    // Get AuthCredential object and set an attribute
    var credential = new sn_auth.AuthCredential();
    credential.setAttribute("user_name", "admin");
     
    // Sign the request and return an AuthCredential attribute value
    var signingAPI = new sn_auth.RequestAuthAPI(httpRequestData, credential);
    var signingCredential = signingAPI.getAuthCredential();
    name = signingCredential.getAttribute("name");

## 認証情報:setAttribute(文字列キー、文字列値) {#ariaid-title4}

AuthCredential オブジェクトの属性を設定します。
{#AuthCredential-setAttribute_S_S__table_off_jsx_5jb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| key | 文字列 | 設定する属性の名前。空の AuthCredential オブジェクトを作成した場合は、このメソッドを使用してオブジェクトにプロパティを追加する必要があります。認証情報レコードを使用して AuthCredential オブジェクトをインスタンス化した場合は、認証情報 \[discovery_credentials\] テーブルからフィールド名を渡して値を設定します。 |
| value | 文字列 | 属性の値。 |
[表 : 4. パラメーター]

{#AuthCredential-setAttribute_S_S__table_off_jsx_5jb} {#AuthCredential-setAttribute_S_S__table_pff_jsx_5jb__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 5. 返される内容]

{#AuthCredential-setAttribute_S_S__table_pff_jsx_5jb}  

    // Define the HttpRequestData object
    var endpoint= "https://third-party-endpoint";
    var httpRequestData = new sn_auth.HttpRequestData();
    httpRequestData.setEndpoint(endpoint);
    httpRequestData.setService('s3');
    httpRequestData.setRegion('us-east-1');
    httpRequestData.setHttpMethod("PUT");
    var content = "Action=SendMessage&MessageBody=This is a test message";
    httpRequestData.setContent(content);
    httpRequestData.addHeader('x-amz-acl' , 'public-read' );
     
    // Get AuthCredential object and set an attribute
    var credential = new sn_auth.AuthCredential();
    credential.setAttribute("user_name", "admin");


