반응 네이티브에서 Facebook 로그인 오류를 처리해야합니다.네이티브 FB SDK 처리 인증 거부 처리
"Facebook. Application would like to access your basic profile info and list of friends."
두 가지 옵션 : "OK" "허용 안 함"신선한 내 응용 프로그램의 설치 한 후 로그인을 시도
는사용자에게 팝업을 보여줍니다. 정상적인 흐름으로 나는 적절한 토큰을 얻습니다. 이 취소 된 이유에 대한 정보가없는
{
"isCancelled": true,
"grantedPermissions": null,
"declinedPermissions": null
}
: 사용자가 onLoginFinished
에서 거부하는 경우 그러나 나는 다음과 같은 결과를 얻을. 거부로 인해 "isCancelled": true
을 'system_account'
으로 가져 오는 유일한 이유는 무엇입니까?
'system_account'
로 로그인하기 :
{
"code": "FacebookSDK",
"domain": "com.facebook.sdk.login",
"framesToPop": 1,
"nativeStackIOS": [...],
"userInfo": {
"NSLocalizedDescription": "Access has not been granted to the Facebook account. Verify device settings.",
"com.facebook.sdk:FBSDKErrorLocalizedDescriptionKey": "Access has not been granted to the Facebook account. Verify device settings."
}
}
그것은 내게 사용자에게 보여줄 수있는 오류를 제공하지만 신뢰성을 구문 분석 할 수 없습니다 지역화된다. 그래서 질문은 사용자가 권한을 부여하지 않았을 때 어떻게 안정적으로 탐지 할 수 있습니까?
코드 내가 가진 : 내가 생각할 수있는 어떤에서
import React from 'react'
import {AccessToken, LoginManager} from 'react-native-fbsdk'
class Login extends React.Component {
login =()=>{
LoginManager.setLoginBehavior('system_account')
LoginManager.logInWithReadPermissions()
.then(this.onLoginFinished)
.catch(this.onLoginError)
}
onLoginFinished = (result)=>{
if(result.isCancelled) {
//
} else {
AccessToken.getCurrentAccessToken().then((data)=>{
this.props.onLogin(data.accessToken.toString())
})
}
}
onLoginError = (error)=>{
// Want to handle this case but
//can only show a message to the user =(
}
render() {
return (
<View>
<TouchableHighlight onPress={this.login}>
<View><Text>Facebook</Text></View>
</TouchableHighlight>
</View>
)
}
}
은 'system_account'
으로 취소하고 유일한 방법은 별도의 동작을 처리받은 후 'native'
로그인 행동에 스위치를 만들 수 있습니까?