验证邮件内的链接不起作用

时间:2018-03-10 07:51:18

标签: node.js parse-server mailgun pfuser email-verification

有人可以解释,或者更好地告诉我如何解决这个问题?

在"帐户创建验证电子邮件中找到的链接"在Parse-Server(/ Heroku)上,无法正常工作。

index.js中的相关代码如下:

var api = new ParseServer({
  databaseURI: .....,
  cloud: .....,
  appId: .....,
  ..........
  publicServerURL: process.env.PARSE_PUBLIC_SERVER_URL || 'https://myapp.herokuapp.com',
  appName: 'WonderApp',
  ..........
  verifyUserEmails: true,
  emailAdapter: {
    module: 'parse-server-mailgun',
    options: {
      // The address that your emails come from
      fromAddress: 'yaya@abc.com',
      // Your domain from mailgun.com
      domain: 'xyz.com',
      // Your API key from mailgun.com
      apiKey: 'key-key-key-key-key-key-key-key',
      // The template section 
      templates: {
        verificationEmail: {
          subject: 'Confirm your account',
          pathPlainText: resolve(__dirname, 'verification_email.txt')
        },
      }
    }
  }
});

创建帐户时,会按预期发送验证邮件。 用户也会收到它(如预期的那样)。邮件看起来像:

Please confirm your account by clicking on the link below.

https://myapp.herokuapp.com/apps/YAdLIExyzABC(K#!qB....../verify_email?token=....uxY&username=theguy

但是,当点击此处的链接时,网页浏览器中会显示以下内容:

Cannot GET /apps/YAdLIExyzABC(K 

这不是我的期望。

有人能看出问题所在吗?

我注意到的另一件事是,在尝试了许多解决这个问题的方法之后,在网络浏览器中键入以下行时:

https://myapp.herokuapp.com/apps/

我明白了:

无法获取/ apps /

我觉得这不应该发生。但有人知道为什么会这样吗?

1 个答案:

答案 0 :(得分:0)

网址部分 YAdLIExyzABC(K#!qB...... 是您的应用 ID。

应用 ID 似乎包含不允许在 URL 中使用的无效字符,例如 (#!。应用 ID 应仅包含字符和数字。

在您在这里发布的配置中,您将应用 ID 替换为 .....,因此要确定,有必要查看您实际设置的应用 ID。

相关问题