0

我正在使用 NodeJS,并希望在后端使用 Apple 登录功能。我选择做的模块是apple-singin-auth

因为 web 还没有实现,所以我必须生成一个 URL 请求来获得授权,像这样:

import appleSignin from 'apple-signin-auth';
// OR const appleSignin = require('apple-signin-auth');
// OR import { getAuthorizationUrl } from 'apple-signin-auth';

const options = {
  clientID: 'com.company.app', // Apple Client ID
  redirectUri: 'http://localhost:3001/auth/apple/callback',
  // OPTIONAL
  state: 'state', // optional, An unguessable random string. It is primarily used to protect against CSRF attacks.
  responseMode: 'query' | 'fragment' | 'form_post', // Force set to form_post if scope includes 'email'
  scope: 'email' // optional
};

const authorizationUrl = appleSignin.getAuthorizationUrl(options);

结果是: https://appleid.apple.com/auth/authorize?response_type=code&state=state&client_id=com.company.app&redirect_uri=http%3A%2F%2Flocalhost%3A3001%2Fauth%2Fapple%2Fcallback&scope=openid+email&response_mode =form_post

当我单击链接并显示一个弹出窗口时,我使用手指 ID 登录到我的 Apple 帐户。但是,有一个错误 登录

未设置完成

错误 我还创建了一个 API (http://localhost:3001/auth/apple/callback) 来检索来自苹果的请求,但没有请求到来。

4

0 回答 0