OAuth2.0 クライアントログイン情報フローを実行するための外部クライアントアプリケーション作成手順と、cURLコマンドを使用したトークン取得手順を解説します。なお、後述の手順は一般的な動作確認を行うための設定例です。ご利用の外部システムやアプリケーションの要件に応じて、外部クライアントアプリケーションの詳細なオプションや、リクエスト時の情報などは調整してください。
以下に設定および実行手順の例をご紹介します。
1. [設定] から [外部クライアントアプリケーションマネージャー] へ遷移します。
2. [新規外部クライアントアプリケーション] をクリックします。
3. 以下の設定を実施して、[作成] をクリックします。
4. 作成した外部クライアントアプリケーションの設定ページで、[ポリシー] タブ内で '編集' をクリックし、"OAuth ポリシー" セクションを開きます。
5. [クライアントログイン情報フローを有効化] をクリックしてチェックをつけます。
6. [(ユーザー名) として実行] に実行させる任意のユーザーのユーザー名を入力します。
7. '保存' をクリックします。
8. 作成した外部クライアントアプリケーションの設定ページで、[設定] タブ内の "OAuth" セクションを開きます。
9. [コンシューマー鍵と秘密] をクリックします。
10. [ID を検証] のプロセスを完了させます。
11. 表示される「コンシューマー鍵 (client_id)」と「コンシューマーの秘密 (client_secret)」を控えます。
注意: cURL コマンドは URL を用いて HTTP/HTTPS などのプロトコルでデータ送信を行うオープンソースのソフトウェアです。弊社 Salesforce 提供のツールではございません。ご利用の際には外部サイトを適宜ご参照ください。
1. 以下の形式で cURL コマンドを実行します。
| curl -X POST "{myDomain}/services/oauth2/token" -d "grant_type=client_credentials&client_id={client_id}&client_secret={client_secret}" |
2. コマンドラインで access_token が返却されていることを確認します。
| {"access_token":"AAAAA","signature":"BBBBB","scope":"api","instance_url":"CCCCC","id":"DDDDD","token_type":"Bearer","issued_at":"EEEEE"} |
以上の手順で OAuth2.0 クライアントログイン情報フローによるアクセストークンの取得動作を確認できます。
コンシューマー鍵、コンシューマーの秘密、アクセストークンは機密情報です。実装・運用時には外部への漏洩を防ぐため、適切なセキュリティ対策を講じて管理してください。
本記事においては、cURL コマンドにより動作確認の手順をご紹介しましたが、実際には外部システムより各要求が行われます。API 実行元のシステムや業務上の要件に応じた設定を行う必要があるため、必要に応じてシステム開発者様やアプリ提供元企業まで外部クライアントアプリケーションの設定方法をご相談ください。
サーバー間インテグレーション用の OAuth 2.0 クライアントログイン情報フロー
Retirement of OAuth 2.0 Username-Password Flow for Connected Apps (Release Update)
005318034

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.