我使用最新版本的sign_in_with_apple,并使用以下代码来允许通过Apple登录我在Android上的Flutter应用程序。
final credential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
webAuthenticationOptions: WebAuthenticationOptions(
clientId: '***Service Identifier***',
redirectUri:
// For web your redirect URI needs to be the host of the "current page",
// while for Android you will be using the API server that redirects back into your app via a deep link
kIsWeb ? Uri.parse('https://${window.location.host}/') : Uri.parse('https://***Backend***/callback'),
),
nonce: nonce,
);
Run Code Online (Sandbox Code Playgroud)
我从README.md包中获取了后端代码:
apple_router.post("/callback", (request, response) => {
console.log(">>> Apple callback received <<<");
console.log("Body:");
console.log(request.body);
console.log("Query:");
console.log(request.query); …Run Code Online (Sandbox Code Playgroud) authentication dart flutter apple-sign-in apple-authentication