Ibm cloud serverles SPA的应用程序ID自定义小部件

Ibm cloud serverles SPA的应用程序ID自定义小部件,ibm-cloud,ibm-appid,Ibm Cloud,Ibm Appid,如何为serverles安全SPA应用程序创建自定义IBM Cloud App ID登录小部件云目录 安全SPA应用程序将通过网关API仅使用IBM云功能 我是否只需要实现一个云功能来定制小部件并保持我的应用服务器如我所愿 我从文件中找不到线索 想法 @Jarkko如果您不想使用App ID登录小部件,而是自己收集凭据并从云函数使用ROP REST API。您可以这样做: let request = require('request'); // put your App ID credenti

如何为serverles安全SPA应用程序创建自定义IBM Cloud App ID登录小部件云目录

安全SPA应用程序将通过网关API仅使用IBM云功能

我是否只需要实现一个云功能来定制小部件并保持我的应用服务器如我所愿

我从文件中找不到线索

想法


@Jarkko

如果您不想使用App ID登录小部件,而是自己收集凭据并从云函数使用ROP REST API。您可以这样做:

let request = require('request');

// put your App ID credentials here (can be found in App ID console):
let credentials = {
    "version": 3,
    "clientId": "xxxxx",
    "secret": "xxxxx",
    "tenantId": "xxxxx",
    "oauthServerUrl": "https://appid-oauth.eu-gb.bluemix.net/oauth/v3/xxxxx",
    "profilesUrl": "https://appid-profiles.eu-gb.bluemix.net"
};


function main(params) {
    return new Promise(function (resolve, reject) {
        request({
            url: credentials.oauthServerUrl + '/token',
            method: 'POST',
            auth: {
                username: credentials.clientId,
                password: credentials.secret
            },
            form: {

                grant_type: "password",
                // replace with actual credentials:
                username: "aaa@bbb.com",
                password: "11111111"
            }
        }, function (error, response, body) {
            resolve(response);
            // handle errors...
        });
    })
}

在这种情况下,响应将是应用程序ID访问令牌

是否要使用应用程序ID登录小部件?或者提供您自己的自定义UI,自己收集用户的凭据,然后使用REST API使用这些凭据获取令牌?谢谢Moty Drimer。虽然我现在在网关API和带参数的云函数调用方面有问题,但这对于另一个线程来说是值得的。