EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 444 forks source link

Seem the "Link Multiple Auth Providers to an Account" not working for apple signin credentials #1599

Closed ngocnt1 closed 4 years ago

ngocnt1 commented 4 years ago

in firebase.ios.ts , i don't see implementation for linkWithCredentialCompletion for apple signin. i tried with my app, it always create separated apple sign-in credential on firebase instead of link it to current user, am i wrong somewhere? @EddyVerbruggen

trueandperfect commented 4 years ago

I solved this by using the firebase rest api:

  request({
    url: 'https://identitytoolkit.googleapis.com/v1/accounts:update?key=' + environment.firebaseApi,
    method: "POST",
    headers: { "Content-Type": "application/json" },
    content: JSON.stringify({
      idToken: token,
      email: email,
      password: password,
      returnSecureToken: true
    })
  }).then((response) => {
      resolve(response);
    }, (e) => {
      console.log('linkWithEmail Request Error: ' + e);

    });

You need to pass in the auth token id of the current user.