[用户向Google注册帐户后,不会触发Auth0挂钩

问题描述 投票:0回答:1

[无论用户何时通过Google创建帐户,都应触发一个钩子,以植入用户所需的数据。不幸的是,它以某种方式不起作用。

不过,如果用户在本地创建帐户,它确实起作用。

enter image description here

我已经尝试过使用Auth0的默认凭据以及我自己的凭据...不幸的是,这没有任何区别。这是代码:

/**
@param {object} user - The user being created
@param {string} user.id - user id
@param {string} user.tenant - Auth0 tenant name
@param {string} user.username - user name
@param {string} user.email - email
@param {boolean} user.emailVerified - is e-mail verified?
@param {string} user.phoneNumber - phone number
@param {boolean} user.phoneNumberVerified - is phone number verified?
@param {object} user.user_metadata - user metadata
@param {object} user.app_metadata - application metadata
@param {object} context - Auth0 connection and other context info
@param {string} context.requestLanguage - language of the client agent
@param {object} context.connection - information about the Auth0 connection
@param {object} context.connection.id - connection id
@param {object} context.connection.name - connection name
@param {object} context.connection.tenant - connection tenant
@param {object} context.webtask - webtask context
@param {function} cb - function (error, response)
*/
const f = require("node-fetch");

module.exports = function(user, context, cb) {
  // Perform any asynchronous actions, e.g. send notification to Slack.

  const evt = {
    accountType: "INSTITUTION",
    user: user,
    email: user.email,
    tenant: {
      id: user.id,
      name: user.username
    },
    schoolYear: "2019-2020"
  };

  // The URL of the API Gateway from AWS.
  f("https://lambda-url.amazonaws.com/production", {
    method: "post",
    body: JSON.stringify(evt),
    headers: { "Content-Type": "application/json" }
  });

  cb();
};

但是,一旦用户使用Google注册帐户,似乎什么也没运行。

编辑:

@@ CodingMorrison:

非常感谢您的回复! I have recorded the requests within a HAR file,并且在控制台或日志内的JSON响应中我都没有发现任何问题。

[这是日志中的快照(我继续创建了两个快照:本地Auth0用户和Google用户)enter image description here

这是成功的google-oauth2响应:

// This is the response from the 
{
  "date": "2019-12-14T12:55:54.457Z",
  "type": "ss",
  "connection": "google-oauth2",
  "connection_id": "suppressed-for-security",
  "client_id": "suppressed-for-security",
  "client_name": "Schon",
  "ip": "190.167.241.8",
  "user_agent": "Firefox 70.0.0 / Windows 10.0.0",
  "details": {
    "prompts": [
      {
        "name": "oauth2-authenticate",
        "initiatedAt": 1576328144356,
        "completedAt": 1576328154233,
        "connection": "google-oauth2",
        "connection_id": "suppressed-for-security",
        "strategy": "google-oauth2",
        "identity": "110542431425060054283",
        "stats": {
          "loginsCount": 1
        },
        "elapsedTime": 9877
      },
      {
        "name": "login",
        "flow": "login",
        "initiatedAt": 1576328102203,
        "completedAt": 1576328154236,
        "timers": {
          "rules": 199
        },
        "user_id": "google-oauth2|110542431425060054283",
        "user_name": "[email protected]",
        "elapsedTime": 52033
      }
    ],
    "initiatedAt": 1576328102201,
    "completedAt": 1576328154455,
    "elapsedTime": 52254,
    "session_id": "suppressed-for-security",
    "device_id": "suppressed-for-security"
  },
  "hostname": "myhost.auth0.com",
  "user_id": "google-oauth2|110542431425060054283",
  "user_name": "[email protected]",
  "strategy": "google-oauth2",
  "strategy_type": "social",
  "log_id": "90020191214125558476000978979202312832857904117618573442",
  "_id": "90020191214125558476000978979202312832857904117618573442",
  "isMobile": false,
  "description": "Successful signup"
}

这是本地管理用户的成功注册响应:

{
  "date": "2019-12-14T12:57:05.511Z",
  "type": "ss",
  "description": "Successful signup",
  "connection": "Username-Password-Authentication",
  "connection_id": "con_QTrYODDyXlXqr1mA",
  "client_id": "secret-id",
  "client_name": "Schon",
  "ip": "190.167.241.8",
  "user_agent": "Firefox 70.0.0 / Windows 10.0.0",
  "details": {
    "body": {
      "tenant": "dev-qm4937yq",
      "client_id": "secret-id",
      "connection": "Username-Password-Authentication",
      "email": "[email protected]",
      "password": "*****",
      "request_language": "en-US,en;q=0.5"
    },
    "query": {
      "method": "POST",
      "host": "login.auth0.com",
      "port": 443,
      "resource": "/lo/users/direct",
      "id": "t3kVcfcDYX_mQXeXxy35W--PVShKHO4x"
    },
    "device_id": "secret"
  },
  "user_id": "auth0|5df4dc213eb6c90eb98f8ec7",
  "user_name": "[email protected]",
  "strategy": "auth0",
  "strategy_type": "database",
  "log_id": "90020191214125711760002735738646670240721436289261371474",
  "_id": "90020191214125711760002735738646670240721436289261371474",
  "isMobile": false
}

这里是HAR文件:https://drive.google.com/open?id=1EWEniDR3c5PhwSYR_dCIHrLai8Okr0-p

javascript aws-lambda auth0 google-oauth2
1个回答
0
投票

我正在Auth0社区小组工作,我很好奇您是否在触发该钩子时是否在Auth0仪表板日志中看到任何内容?有什么错误吗?如果您捕获了HAR文件怎么办?谢谢!

© www.soinside.com 2019 - 2024. All rights reserved.