Edo*_*ier 10 linkedin ios firebase swift firebase-authentication
我正在构建一个应用程序,我希望人们能够注册他们的LinkedIn帐户.
我正在使用Firebase作为后端,FirebaseAuth框架目前不支持LinkedIn.
我知道Firebase允许自定义身份验证系统,但即使在阅读了有关此问题的文档之后,我仍然很难理解如何在那里插入LinkedIn以及所谓的身份验证服务器.
有人设法使这项工作?
提前感谢您的意见.
在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)
| 归档时间: |
|
| 查看次数: |
5885 次 |
| 最近记录: |