Javascript 如何在firebase登录或登录中设置或添加自定义提供商名称,如linkedin、instagram?
在的帮助下,我正在将LinkedIn和Instagram登录添加到我的应用程序中。这很有效。但是我想用登录名设置提供者名称。知道怎么设置吗? 将用户设置为Javascript 如何在firebase登录或登录中设置或添加自定义提供商名称,如linkedin、instagram?,javascript,node.js,firebase,firebase-authentication,firebase-admin,Javascript,Node.js,Firebase,Firebase Authentication,Firebase Admin,在的帮助下,我正在将LinkedIn和Instagram登录添加到我的应用程序中。这很有效。但是我想用登录名设置提供者名称。知道怎么设置吗? 将用户设置为 async function createFirebaseAccount(linkedinID, displayName, photoURL, email, accessToken) { // The UID we'll assign to the user. const uid = `linkedin:${linkedinID}`;
async function createFirebaseAccount(linkedinID, displayName, photoURL, email, accessToken) {
// The UID we'll assign to the user.
const uid = `linkedin:${linkedinID}`;
// Save the access token tot he Firebase Realtime Database.
const databaseTask = admin.database().ref(`/linkedInAccessToken/${uid}`).set(accessToken);
// Create or update the user account.
const userCreationTask = admin.auth().updateUser(uid, {
displayName: displayName,
photoURL: photoURL,
email: email,
emailVerified: true
}).catch((error) => {
// If user does not exists we create it.
if (error.code === 'auth/user-not-found') {
return admin.auth().createUser({
uid: uid,
displayName: displayName,
photoURL: photoURL,
email: email,
emailVerified: true
});
}
throw error;
});
// Wait for all async task to complete then generate and return a custom auth token.
await Promise.all([userCreationTask, databaseTask]);
// Create a Firebase custom auth token.
const token = await admin.auth().createCustomToken(uid);
console.log('Created Custom token for UID "', uid, '" Token:', token);
return token;
}
我在读关于它的书,但不知道如何使用它。有什么例子吗?
提前感谢。Firebase身份验证实际上目前只支持少数身份提供商,如Google、Facebook、Twitter和GitHub所述 如果您想使用您提到的任何其他提供商,您需要使用 我还将附上更多关于如何使用Instagram设置Firebase的阅读资料 我希望这有帮助