• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript facebook.Facebook类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@ionic-native/facebook.Facebook的典型用法代码示例。如果您正苦于以下问题:TypeScript Facebook类的具体用法?TypeScript Facebook怎么用?TypeScript Facebook使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Facebook类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: signOut

  signOut() : firebase.Promise<any> {
    if (this.angularFireAuth.auth.currentUser.providerData.length) {
      for (var i = 0; i < this.angularFireAuth.auth.currentUser.providerData.length; i++) {
        var provider = this.angularFireAuth.auth.currentUser.providerData[i];

        if (provider.providerId == firebase.auth.GoogleAuthProvider.PROVIDER_ID) { // Se for o gooogle
          // o disconnect limpa o oAuth token e tambem esquece qual conta foi selecionada para o login
          return this.googlePlus.disconnect()
            .then(() => {
              return this.signOutFirebase();
            });
        } else if (provider.providerId == firebase.auth.FacebookAuthProvider.PROVIDER_ID) { // Se for facebook
          return this.facebook.logout()
            .then(() => {
              return this.signOutFirebase();
            })
        } else if (provider.providerId == firebase.auth.TwitterAuthProvider.PROVIDER_ID) { // Se for twitter
          return this.twitter.logout()
            .then(() => {
              return this.signOutFirebase();
            })
        }
      }
    }

    return this.signOutFirebase();
  }
开发者ID:joaorobertoifrn,项目名称:ionicfirebaseauth,代码行数:27,代码来源:auth-service.ts


示例2: Promise

    return new Promise((resolve, reject) => {
      if (this.plt.is('cordova')) {
        this.facebook.login(["email"])
          .then(loginResponse => {
            let credential = firebase.auth.FacebookAuthProvider.credential(loginResponse.authResponse.accessToken)
            this.afAuth.auth.signInAndRetrieveDataWithCredential(credential)
              .then(info => {
                resolve(info)
                this.loginJobs();
              })
              .catch(err => {
                reject(err)
                alert(err)
              })
          })
          .catch(err => {
            reject(err)
            alert(err)
          })

      } else {
        this.afAuth.auth
          .signInWithPopup(new firebase.auth.FacebookAuthProvider())
          .then(info => {
            resolve(info)
            this.loginJobs();
          })
          .catch(err => {
            reject(err)
            alert(err)
          })
      }
    })
开发者ID:Microsmsm,项目名称:Dawaey,代码行数:33,代码来源:auth.ts


示例3: Promise

 return new Promise((resolve, reject) => {
   if (this.platform.is('cordova')) {
     this.facebook.login(['email', 'public_profile', 'user_friends'])
     .then((facebookData: FacebookLoginResponse) => {
       const loading = this.loadingCtrl.create({
         content: 'Por favor, aguarde...'
       });
       loading.present();
       const credential = firebase.auth.FacebookAuthProvider
         .credential(facebookData.authResponse.accessToken);
       firebase.auth().signInWithCredential(credential).then((firebaseData) => {
         setTimeout(() => {
           this.functions.post('users', {
             facebook: facebookData.authResponse.userID
           }).subscribe((response) => {
             loading.dismiss();
             resolve();
           }, (error) => {
             loading.dismiss();
             reject(error);
           });
         }, 800);
       });
     }, (error) => {
       resolve(error);
     });
   }
 });
开发者ID:squadsea,项目名称:ionic3-angularfire-login,代码行数:28,代码来源:auth.ts


示例4: signInWithFacebook

 signInWithFacebook() {
   return this.facebook.login(['public_profile', 'email'])
     .then((res: FacebookLoginResponse) => {
       //https://developers.facebook.com/docs/graph-api/reference/user
       //Ao logar com o facebook o profile do usuario ĂŠ automaticamente atualizado.
       return this.angularFireAuth.auth.signInWithCredential(firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken));
     });
 }
开发者ID:joaorobertoifrn,项目名称:ionicfirebaseauth,代码行数:8,代码来源:auth-service.ts


示例5: logout

 logout(){
     this.fb.logout().then((res) => 
     console.log('Logged into Facebook!', res)).catch(e => 
     console.log('Error logging into Facebook', e));
     this.googleplus.logout().then((res) => 
     console.log('logged out of google',res)).catch(err => console.error(err));
     localStorage.clear();
     this.navCtrl.setRoot(LoginPage);
  }
开发者ID:Tanisha9000,项目名称:shaddivendor,代码行数:9,代码来源:logout.ts


示例6: nativeFacebookLogin

  async nativeFacebookLogin(): Promise<void> {
    try {
      const response = await this.facebook.login(["email", "public_profile"]);
      const facebookCredential = firebase.auth.FacebookAuthProvider.credential(
        response.authResponse.accessToken
      );

      const firebaseUser = await firebase
        .auth()
        .signInWithCredential(facebookCredential);

      return await this.updateUserData(firebaseUser);
    } catch (err) {
      console.log(err);
    }
  }
开发者ID:ctimbi,项目名称:test,代码行数:16,代码来源:auth.ts


示例7: login

  login(): void {
      this.loading.present();
      this.Facebook.login(['public_profile']).then((response) => {
          this.getProfile();
      },
      (err) => {
          console.log(err);
          let alert = this.alertCtrl.create({
            title: 'Oops!',
            subTitle: 'Something went wrong, please try again later.',
            buttons: ['Ok']
          });

          this.loading.dismiss();
          alert.present();
      });
  }
开发者ID:aldokhayel,项目名称:camperchat,代码行数:17,代码来源:login.ts


示例8:

 return Observable.create((observer) => {
   if (this.platform.is('cordova')) {
     this.facebook.login(['email', 'public_profile', 'user_friends'])
     .then((facebookData: FacebookLoginResponse) => {
       const credential = firebase.auth.FacebookAuthProvider
         .credential(facebookData.authResponse.accessToken);
       firebase.auth().currentUser.linkWithCredential(credential).then((user) => {
         this.data.update(`users/${user.uid}`, {
           facebook: facebookData.authResponse.userID
         }).then(() => {
           observer.next();
         }, (error) => {
           observer.error(error);
         });
       });
     });
   }
 });
开发者ID:squadsea,项目名称:ionic3-angularfire-login,代码行数:18,代码来源:auth.ts


示例9: login

 login(): void {
   this.facebook.login(['public_profile']).then((response) => {
     this.getProfile();
   }, (err) => {
     this.getProfile();
   });
 }
开发者ID:baptistesa,项目名称:camper,代码行数:7,代码来源:login.ts


示例10: resolve

 this.http.post(this.storageProvider.serverAddress+"/logout",JSON.stringify({version:this.storageProvider.version}),{headers: headers}).map(res=>res.json()).subscribe((res)=>{
     this.fb.logout().then((result)=>{
          resolve(res); 
     },(err)=>{
           resolve(res);
     });
 },(err)=>{
开发者ID:raceyi,项目名称:takit,代码行数:7,代码来源:fb-provider.ts



注:本文中的@ionic-native/facebook.Facebook类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript file.File类代码示例发布时间:2022-05-28
下一篇:
TypeScript core.getPromise函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap