问“你已经授权”是否正常通过Facebook SDK [英] Is it normal to ask "you have already authorize " through Facebook SDK
问题描述
在我的情况下,我在Facebook应用程序设置中设置了SSO 不解决问题!!
每当我的登录窗口显示,我注销Facebook并清除访问令牌,首先我想是因为这样,这是被问到,我省略了代码,仍然是要求!
如果需要,我可以发布代码!!!
override func viewDidLoad(){
super.viewDidLoad ()
fbloginButton.delegate = self
fbloginButton.readPermissions = [public_profile,email,user_friends]
if(FBSDKAccessToken.currentAccessToken )!= nil)
{
var loginM:FBSDKLoginManager = FBSDKLoginManager()
loginM.logOut()
FBSDKAccessToken.setCurrentAccessToken(nil)
}
}
@IBAction func loginFb(发件人:AnyObject)
{
fbLoginManager.logInWithReadPermissions([email],fromViewController:self.presentingViewController,handler:{(result,error) - > Void in
if(error == nil){
var fbloginresult:FBSDKLoginManagerLoginResult = result
}
})
}
func loginButton(loginButton:FBSDKLoginButton !, didCompleteWithResult result:F BSDKLoginManagerLoginResult !,错误:NSError!){
NSLog(didCompleteWithResult)
if((error)!= nil)
{
}
else if result.isCancelled {
}
else {
//如果您一次要求多个权限,则
//应该检查是否缺少
如果result.grantedPermissions.contains(email)
{
///这里我调用一个函数来获取数据
}
}
我工作了一段时间使用Facebook SDK,但我认为当您注销时,您只会使当前的accessToken无效,并结束会话,但不会对您的应用进行取消授权。
所以,当你登录后,您只需为已经授权的FB应用程序生成一个新的accessToken。您需要再次登录(以验证您的身份),但您不需要再次授权,因此它会给您该消息。
有一个Graph API调用撤销权限,如果这是您正在寻找的。 p>
如果您的问题是否是正常。是的,我会说这是正常的。这是一个可视化的指示,你在这一点再次与以前授权的FB应用程序连接。通过不发送任何权限避免这种情况可能会起作用,但是您通常不知道已经授权的用户是否再次登录,还是全新的用户。如果后者没有权限登录,那么你的应用程序不会按照应用程序工作。
This is just a question, if I log in once with Facebook login using the latest SDK and then I try to log in again, its asking me "you have already authorize app name". Is it normal or Do I have to change something to avoid it.
In my scenario, I made SSO on in Facebook App Setting this does not resolve the issue!!
Whenever my login window shows, I logout the Facebook and clear the access token, first I thought because of this, this is being asked however, I omitted the code and still it is asking!! I can post code if necessary!!!
override func viewDidLoad() {
super.viewDidLoad()
fbloginButton.delegate = self
fbloginButton.readPermissions = ["public_profile", "email", "user_friends"]
if (FBSDKAccessToken.currentAccessToken() != nil)
{
var loginM:FBSDKLoginManager = FBSDKLoginManager()
loginM.logOut()
FBSDKAccessToken.setCurrentAccessToken(nil)
}
}
@IBAction func loginFb(sender:AnyObject)
{
fbLoginManager.logInWithReadPermissions(["email"], fromViewController: self.presentingViewController, handler: { (result, error) -> Void in
if (error == nil){
var fbloginresult : FBSDKLoginManagerLoginResult = result
}
})
}
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
NSLog("didCompleteWithResult")
if ((error) != nil)
{
}
else if result.isCancelled {
}
else {
// If you ask for multiple permissions at once, you
// should check if specific permissions missing
if result.grantedPermissions.contains("email")
{
///Here I call a function to get data
}
}
It's been a while since I've worked with the Facebook SDK, but I think when you logout, you just invalidate your current accessToken and end your session, but it does not deauthorize your app.
So, when you login, you just generate a new accessToken for the FB app that you already authorized. You need to login again (to verify your identity), but you don't need to authorize again, hence it's giving you that message.
There's a Graph API call to revoke permissions, if that is what you are looking for.
And if your question is whether this is "normal". Yes, I'd say that's normal. It's a visual indication that you are at that point connecting again with a previously authorized FB app. Avoiding it might work by not sending any permissions, but you generally don't know if an already authorized user is logging in again, or a completely new user. If the latter logs in without permissions, well, your app wouldn't work as supposed too.
这篇关于问“你已经授权”是否正常通过Facebook SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!