Skip to content

Commit cf438b3

Browse files
committed
- fix Url for social login with Facebook SDK
1 parent 2c21606 commit cf438b3

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/urls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const Urls = {
8585
userResendConfirmation: email => `${Urls.users()}/resendconfirmation/${email}`,
8686
userSocial : () => `${Urls.users()}/social`,
8787
userSocialOAuth : socialType => `${Urls.userSocial()}/oauth/${socialType.toLowerCase()}/request_url`,
88-
userSocialLogin : socialType => `${Urls.userSocial()}/${socialType.toLowerCase()}/login/${LocalVars.applicationId}`,
88+
userSocialLogin : socialType => `${Urls.userSocial()}/${socialType.toLowerCase()}/sdk/login`,
8989
}
9090

9191
export default Urls

src/users/social/facebook.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ export const loginWithFacebookSdk = (fieldsMapping, stayLoggedIn, options) => {
1616
return reject(new Error('Facebook SDK not found'))
1717
}
1818

19-
const asyncHandler = new Async(resolve, reject)
19+
function loginRequest(response) {
20+
const requestData = {
21+
...response,
22+
accessToken: response.authResponse.accessToken
23+
}
24+
25+
sendSocialLoginRequest(requestData, 'facebook', fieldsMapping, stayLoggedIn, new Async(resolve, reject))
26+
}
2027

2128
FB.getLoginStatus(response => {
2229
if (response.status === 'connected') {
23-
sendSocialLoginRequest(response, 'facebook', fieldsMapping, stayLoggedIn, asyncHandler)
30+
loginRequest(response)
2431
} else {
25-
FB.login(response => {
26-
sendSocialLoginRequest(response, 'facebook', fieldsMapping, stayLoggedIn, asyncHandler)
27-
}, options)
32+
FB.login(response => loginRequest(response), options)
2833
}
2934
})
3035
})

0 commit comments

Comments
 (0)