我正在使用 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);
当我单击链接并显示一个弹出窗口时,我使用手指 ID 登录到我的 Apple 帐户。但是,有一个错误
未设置完成
我还创建了一个 API (http://localhost:3001/auth/apple/callback) 来检索来自苹果的请求,但没有请求到来。