An AngularJS and Firebase (with routing) seed generated by Yeoman, with Facebook simpleLogin
Make sure you have Yeoman installed with the AngularJS-generator and the AngularFire-generator. I also use Cordova/Phonegap to build my webapp to native mobile platforms.
In this example I use android platform, Facebook login and routing in AngularJS.
cordova create loginExample com.example.hello AngularFireLogin
cd loginExample
cordova platform add android
mkdir dev && cd dev
yo angular
yo angularfire
[?] Name of your Firebase instance:
(required) from your URL: http://INSTANCE
.firebaseio.com[?] Shall I include FirebaseSimpleLogin?
Y[?] Which providers shall I install?
Facebook (select from a list of simple login providers you have enabled for your Firebase)[?] Shall I include routeSecurity?
Y (allows you to specifyauthRequired
on a route and force user to log in before they can view it)[?] Shall I create a rudimentary login screen?
Y (this creates views/login.html and controllers/login.js, which provide registration (for password auth) and authentication)
- Go to your forge at Firebase and click simpleLogin at the left bar. Enable Facebook.
- Make an app at Facebooks developers site. Take note of your App ID and App Secret.
- In your Facebook application configuration, enable the 'Website with Facebook Login' integration and set your 'Site URL' to: https://auth.firebase.com/auth/facebook/callback
- Depending on what version of the generators, you may have to tweak some code and and add a logout button and a controller to it.
- Remember to include in your index.html:
<script src="cordova.js"></script>
- SimpleLogin requires inAppBrowser.
cordova plugin add org.apache.cordova.inappbrowser
- Build your code with grunt build and replace the code in your www folder with the files in your dist folder. Then it should be ready:
cordova run android