简体   繁体   中英

Apple signin in through Nodejs (Backend)

Trying to verify idToken of a user signed in via firebase authentication (Apple signin) in nodejs server.

const appleSignin = require("apple-signin-auth");

let appleClient = {
  dev: "com.domine.app.ios.dev",
  prod: "com.domine.app.ios",
};
async function appleLoginVerify(idToken) {
  try {
    const userResp = await appleSignin.verifyIdToken(idToken, {
      audience: appleClient[process.env.ENV],
      ignoreExpiration: true,
    });
    return {
      success: true,
      data: userResp,
    };
  } catch (err) {
    console.log(err.message);
    return {
      success: false,
      message: err.message,
    };
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM