NGXS + Firestore or Firebase Auth - angular

I saw that the NGXS state manager for Angular has released and i'm new to this topic. I'm trying to understand how do i connect the firestore or the firebase auth to NGXS but because it's so new i didn't find information anywhere
on the internet of how to do that, I will be glad if someone could explain me how to connect those. thanks

I haven't used Firebase myself but maybe you could make use of the NGXS + Firebase Demo on NGXS' resource page. Or maybe you could get some usefull information from this video from Angular Firebase on how they use Firebase with NGRX (the framework that NGXS is based on).

Related

Subscribing to realtime updates for an app that is marked as "native'

When I follow the instructions on:
http://developers.facebook.com/docs/reference/api/realtime/
Namely:
1) Retrive an access_token with:
https://graph.facebook.com/oauth/access_token?client_id=<APP_ID>&client_secret=<APP_SECRET>&grant_type=client_credentials
2) Issue a subscription request to https://graph.facebook.com/<app-id>/subscriptions?access_token=...
I receive the error:
{"error":{"message":"(#15) This method is not supported for native apps","type":"OAuthException","code":15}}
My app is marked as a native app under "App Type" on https://developers.facebook.com/apps/<app id>/advanced.
But, to be clear, I am making the subscription request from a server (the same server that I intend to use as my callback server).
So, questions:
Should I be getting an access_token via some other means? Does
the way I'm getting the access token
("grant_type=client_credentials") mean that I'm getting an access token that is supposed to be for a client, rather than a server?
Am I doing something else wrong? Or,
is this just a bug / documentation bug? Nowhere in the realtime API
docs does it say that Native apps are not alllowed to use the realtime API.
Related questions:
How do I subscribe to Facebook Realtime API? is basically my same question, but it's not on facebook.stackoverflow.com and it was answered with a non-answer, so I saw fit to repost.
http://facebook.stackoverflow.com/questions/11141333/using-real-time-updates-from-facebook-graph-api-with-a-client-application is a related question, but again, I am making a subscription request from a SERVER, not a client.
If you setup a canvas_url, you can do client_credentials. So setup native AND canvas (server). It will host a web site version of your app, which is what FB needs to grant that kind of access_token.

Firebase FCM with ReactJS and Webpack not working: We are unable to register the default service worker

Related question with pretty much the same issue: Firebase FCM React project issue - firebase-messaging-sw.js wrong type?
Answers in this question or any other have not worked for me, below is a screenshot of the project tree with firebase-messaging-sw.js file in it, since adding it has been a occuring suggestion to fix this issue.
I would like to know if I am just doing it wrong or why I am not able to register the sw for the firebase to use.
Original error from developer tools console:
"Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script."
As an aswer to this issue, here is another post by me which I also managed to solve myself. FirebaseErrorĀ - messaging/failed-serviceworker-registration
So basically using a very specific version of webpack-dev-server, adding a sw file that can have any name, and registering that file as a service worker for fireabse to use in my firebase messaging initialization file, I managed to get firebase cloud messaging working with webpack. The version of webpack-dev-server is 2.11.0.
Hope this helps anyone with this issue.

Login with Twitter in Angular 2 [duplicate]

I am trying to implement singin functioanlity using angular2 , Read from official documentation also from here , But didn't get how the flow is going on. my questions are
what are the parameters for accessing first step i.e outh_token ?
is there any working example or best articles which teach the flow ?
I have read number of questions on SO but none of them work for me.
any suggestion will be appreciated.
PS: as of now i am Hitting Post request on this URL
let url = 'http://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fgoogle.com%2Ftwittercallback&oauth_consumer_key=my_consumer_key&oauth_nonce=ea9ec8429b68d6b77cd5600adbbb0456&oauth_signature=F1Li3tvehgcraF8DMJ7OyxO4w9Y&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1318467427&oauth_version=1.0';
But throwing error status code 307.
also i had tried using ng2-twitter package but not working.
If you use AngularFire2, then you can get it done by just one line and that is
logintwitter(){
this.afAuth.auth.signInWithPopup(new firebase.auth.TwitterAuthProvider());
}
I suggest looking at great real world example here https://github.com/gothinkster/angular-realworld-example-app which uses oauth. I also implemented my sample angular app with full working client/server code to login to Facebook, Linkedin and Google https://github.com/anjmao/adify using ExpressJs and PassportJs.

Sign-in with twitter using angular

I am trying to implement singin functioanlity using angular2 , Read from official documentation also from here , But didn't get how the flow is going on. my questions are
what are the parameters for accessing first step i.e outh_token ?
is there any working example or best articles which teach the flow ?
I have read number of questions on SO but none of them work for me.
any suggestion will be appreciated.
PS: as of now i am Hitting Post request on this URL
let url = 'http://twitter.com/oauth/request_token?oauth_callback=http%3A%2F%2Fgoogle.com%2Ftwittercallback&oauth_consumer_key=my_consumer_key&oauth_nonce=ea9ec8429b68d6b77cd5600adbbb0456&oauth_signature=F1Li3tvehgcraF8DMJ7OyxO4w9Y&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1318467427&oauth_version=1.0';
But throwing error status code 307.
also i had tried using ng2-twitter package but not working.
If you use AngularFire2, then you can get it done by just one line and that is
logintwitter(){
this.afAuth.auth.signInWithPopup(new firebase.auth.TwitterAuthProvider());
}
I suggest looking at great real world example here https://github.com/gothinkster/angular-realworld-example-app which uses oauth. I also implemented my sample angular app with full working client/server code to login to Facebook, Linkedin and Google https://github.com/anjmao/adify using ExpressJs and PassportJs.

How can I upload a video to Firebase using angularfire2?

I am building a web app using Angular2 and Firebase, and am using angularfire2 for authentication and database interactions. It seems like angularfire2 does not have support for the Firebase storage API yet.
What is the alternative until then?
Can I access the Firebase object and follow the instructions in the Firebase documentation?
yes...
just use the firebase object and follow the directions on website
I use different approach by
create static html+js for the sake of upload only
make angular2 make a popup of upload page then when it complete upload close it self + change state of localStorage
use ngZone + window.addEventListener("storage") to be able to call back after uploading is done
here is other ppl example to use ngZone
http://blog.thoughtram.io/angular/2016/02/01/zones-in-angular-2.html

Resources