使用Facebook的身份验证为一个Android应用程序 [英] Use Facebook authentication for an Android application

查看:116
本文介绍了使用Facebook的身份验证为一个Android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个应用程序,我需要整合Facebook的社交功能。

我想是要知道,如果用户通过Facebook应用程序或使用Facebook的其他应用程序已经连接到Facebook和使用此身份验证。这意味着,如果用户已经通过他的设备连接到Facebook,我承认,在我的应用程序中使用它 - 不要求用户提供一个新的登录。

这可能吗?

我发现在网上很多东西,但没有涉及到这一点。我已经下载了Facebook的SDK,并将其添加到我的项目。我看到有一个方法( facebook.getAccessToken()),以获得访问令牌,但我想我可以用它只有当用户做他的第一次登录我应用程序。

任何帮助将是巨大的。
谢谢你。


解决方案

 这意味着,如果用户已经通过他的设备连接到Facebook,我承认,在我的应用程序中使用它 - 不要求用户提供一个新的登录。

是有可能。这被称为单点登录在Facebook中,默认情况下单点登录是的启用。你必须做一个和唯一的事情是,你需要生成散列密钥和注册与Facebook中创建的应用程序。

此外,也可以通过如下传递一个额外的参数来禁用单单开:

  authenticatedFacebook.authorize(上下文的权限,-1,新LoginListener());

-1 - 指禁用SSO

单点登录的 Facebook的文档 ..

I am working on an application where I need to integrate the social functionality of Facebook.

What I want is to know if the user is already connected to Facebook through a Facebook application or some other application that uses Facebook, and use this authentication. That means that if the user is already connect to Facebook through his device I recognize that and use it in my application - not ask the user for a new login.

Is it possible?

I found a lot stuff in the web, but nothing is related to that. I already downloaded the facebook SDK and added it to my project. I saw that there is a method (facebook.getAccessToken()) to get the access token, but I think I can use it only if the user do his first login in my application.

Any help would be great. Thanks.

解决方案

That means that if the user is already connect to Facebook through his device I recognize that and use it in my application - not ask the user for a new login. 

Yes it is possible..This is called as Single-Sign-On in facebook , by default Single-Sign-On is enabled. One and only thing you have to do is that you need to generate Hash Key and Register with your Application created in Facebook.

Also it is possible to disable Single-Single-On by passing an extra parameter as below :

authenticatedFacebook.authorize(context PERMISSIONS,-1,new LoginListener());

-1 - refers disabling SSO

Single-Sign-On is clearly explained in Facebook Documentation..

这篇关于使用Facebook的身份验证为一个Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆