来自registerWithProvider的未知提供程序

时间:2017-06-03 18:18:49

标签: realm realm-mobile-platform

我正在尝试创建名为“cgpsauth”的自定义身份验证提供程序,当我打电话时,我收到“未知提供程序”:

  var ru = Realm.Sync.User.registerWithProvider(
        "http://localhost:9080",
        "cgpsauth",
        accessToken,
        (error, user) => {...

这是我知道正在加载的提供程序,因为如果我在此文件中出现语法错误,则在启动ROS时出现错误:

module.exports = function(deps) {
  return class CgpsAuthProvider extends deps.BaseAuthProvider {

    static get name() {
      return 'custom/cgpsauth';
    }

    constructor(name, options, requestPromise) {
      super(name, options, requestPromise);
    }

    verifyIdentifier(req) {
      const token = req.body.data;
      return 30;
    }
  }
};

configuration.yml

 providers:
     custom/cgpsauth:
      implementation: cgpsauth.js

1 个答案:

答案 0 :(得分:1)

从客户端SDK使用custom/进行身份验证时,您必须在提供程序名称前添加前缀:

var ru = Realm.Sync.User.registerWithProvider(
    "http://localhost:9080",
    "custom/cgpsauth",
    accessToken,
    (error, user) => {...