測試 Node.js 應用程式
在解決方案的這個部分,您可以:
-
註冊範例 Node.js Web 應用程式,將其與 Oracle Identity Cloud Service 整合以進行驗證
-
設定讓應用程式使用 Oracle Identity Cloud Service 的 SDK 作為 Node.js 程式設計語言
-
準備、執行及測試應用程式
註冊 Node.js 應用程式
若要建立與 Oracle Identity Cloud Service 的通訊,範例 Node.js Web 應用程式需要用戶端 ID 和密碼。您也必須設定 API 權限,才能授予應用程式。
設定 Node.js 應用程式
更新範例 Node.js 應用程式的程式碼,使其使用 Oracle Identity Cloud Service 的 SDK 作為 Node.js 程式設計語言。
編輯 c:\temp\nodejs\auth.js
檔案、使用下列內容更新檔案,然後儲存檔案。
//Oracle Identity Cloud Service connection parameters as a json var
var ids = {
oracle: {
"ClientId": "123456789abcdefghij",
"ClientSecret": "abcde-12345-zyxvu-98765-qwerty",
"ClientTenant": "idcs-abcd1234",
"IDCSHost": "https://%tenant%.identity.oraclecloud.com",
"AudienceServiceUrl" : "https://idcs-abcd1234.identity.oraclecloud.com",
"TokenIssuer": "https://identity.oraclecloud.com/",
"scope": "urn:opc:idm:t.user.me openid",
"logoutSufix": "/oauth2/v1/userlogout",
"redirectURL": "http://localhost:3000/callback",
"LogLevel": "warn",
"ConsoleLog": "True"
}
};
module.exports = ids;
對於 ClientId
和 ClientSecret
參數值,請使用 Oracle Identity Cloud Service 在您註冊 Node.js Web 應用程式時產生的「從屬端 ID」和「從屬端加密密碼」。您可以從本解決方案的「瞭解方法和函數」主題取得 ClientTenant
、IDCSHost
和 AudienceServiceURL
參數的值。