有人设法在iOS上使用Firebase实现LinkedIn登录吗?

Edo*_*ier 10 linkedin ios firebase swift firebase-authentication

我正在构建一个应用程序,我希望人们能够注册他们的LinkedIn帐户.

我正在使用Firebase作为后端,FirebaseAuth框架目前不支持LinkedIn.

我知道Firebase允许自定义身份验证系统,但即使在阅读了有关此问题的文档之后,我仍然很难理解如何在那里插入LinkedIn以及所谓的身份验证服务器.

有人设法使这项工作?

提前感谢您的意见.

Bro*_*onx 10

Firebase身份验证仅支持四个联合身份提供商:Google,Facebook,Twitter和GitHub.

对于每个其他提供商,您必须使用自定义令牌(您将需要外部Web服务).

你可以在这里阅读更多的完整示例(该链接适用于Instagram,但它也适用于LinkedIn).


blu*_*Cat 9

在Firebase官方仓库中查看此示例:将LinkedIn登录使用Firebase

在此示例中,我们使用基于OAuth 2.0的身份验证来获取LinkedIn用户信息,然后创建Firebase自定义令牌(使用LinkedIn用户ID)。


小智 6

Looks like the post is few years old, so not sure if you have found the solution, but for the benefit of everyone. in the current version of firebase, this is how I was able to use LinkedIn.

export function signUpWithLinkedIn() {
    return auth
        .setPersistence(firebase.auth.Auth.Persistence.SESSION)
        .then(()=>{
            const provider = new firebase.auth.OAuthProvider('linkedin.com');
            provider.addScope('r_emailaddress');
            provider.addScope('r_liteprofile');
            auth
                .signInWithPopup(provider)
                .then(result=>{
                    console.group('LinkedIn');
                    console.log(result);
                    console.groupEnd();
                    return result;
                })
                .catch(error=>{
                    console.group('LinkedIn - Error');
                    console.log(error)
                    console.groupEnd();
                    throw error;
                });

        });
}
Run Code Online (Sandbox Code Playgroud)