• Stars
    star
    104
  • Rank 330,604 (Top 7 %)
  • Language
    JavaScript
  • Created about 10 years ago
  • Updated about 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ionic Framework ngCordova Oauth Example for Facebook

Facebook Oauth Example For Ionic Framework

This example will demonstrate how to use ngCordova to authenticate with Facebook and retrieve an access token for use with the Facebook REST API.

Requirements

Configuration

Download this example project from GitHub and run the following commands:

$ ionic platform add android
$ cordova plugin add org.apache.cordova.inappbrowser
$ cordova plugin add cordova-plugin-whitelist

The above commands will add the Android build platform and install the required Apache InAppBrowser plugin.

This example application requires you to have your own Facebook application registered with Facebook.com. Doing so will give you a unique client id that can be included into your project. When registering your application with Facebook, make sure to set the callback uri to http://localhost/callback, otherwise ngCordova will not function.

With the client id in hand, open www/js/app.js and find the following line:

$cordovaOauth.facebook("CLIENT_ID_HERE", ["email", "read_stream", "user_website", "user_location", "user_relationships"])

You will want to replace CLIENT_ID_HERE with the official key.

Usage

With this example project configured on your computer, run the following from the Terminal or command prompt:

$ ionic build android

Install the application binary to your device or simulator.

The application is currently composed of three parts and makes use of two of the official Facebook RESTful APIs.

  1. Oauth sign in
  2. Basic profile (GET /me)
  3. Basic stream (GET /me/feed)

You will be required to sign into the application using your own Facebook username and password. Once logged in, you can view very basic information found in your profile or navigate to your stream. The stream will show posts with a comment and like count.

Version History

0.0.1

  • Add: oauth sign in
  • Add: view profile
  • Add: view feed of recent entries

Have a question or found a bug (compliments work too)?

Tweet me on Twitter - @nraboy

Resources

Ionic Framework - http://www.ionicframework.com

AngularJS - http://www.angularjs.org

Apache Cordova - http://cordova.apache.org

ngCordova - http://www.ngcordova.com

Nic Raboy's Code Blog - https://blog.nraboy.com

More Repositories

1

ng-cordova-oauth

AngularJS oauth library for use with Apache Cordova projects
JavaScript
456
star
2

ngx-cordova-oauth

Angular oauth library for use with Apache Cordova projects
TypeScript
128
star
3

ubuntu-ionic-installer

Installs Android, Apache Ant, Java JDK, NodeJS, Apache Cordova, and Ionic Framework
Shell
108
star
4

unity3d-floppy-clone-game

Flappy Bird type game created with Unity3D
Java
48
star
5

open-ledger-micro

Go
41
star
6

ng-cordova-beacon

AngularJS wrapper for the Apache Cordova iBeacon plugin
JavaScript
39
star
7

hugo-phlat-theme

A flat theme for the Hugo static template engine
CSS
31
star
8

ubuntu-nativescript-installer

Install Node.js, the Android SDK, and Telerik NativeScript in Ubuntu via a single script
Shell
29
star
9

ionic-cipher-safe-app

Store passwords on Firebase using a master password and AES strength encryption with Ionic Framework
JavaScript
27
star
10

cordova-hooks

Useful hooks to be included in Apache Cordova, Ionic Framework, and Phonegap projects
JavaScript
15
star
11

android-spyfi-app

Mobile surveillance application for use with Foscam and Yanmix brand IP cameras.
Java
14
star
12

nativescript-ratings

TypeScript
10
star
13

stream-deck-webhooks

CSS
10
star
14

android-minesweeper-game

Java
9
star
15

ng-cordova-oauth-example

A simple test application for ng-cordova-oauth
JavaScript
9
star
16

ng-imgur

AngularJS library for making RESTful requests to Imgur
JavaScript
7
star
17

alexa-slick-dealer

Slick Dealer Skill for Amazon Alexa
Go
5
star
18

smartcar-here-example

HTML
3
star
19

mongo-draws

JavaScript
2
star
20

tracydevs-unity-example

C#
2
star
21

ionic-imgur-app

An unofficial Imgur photo-sharing application created with Ionic Framework and Apache Cordova
JavaScript
2
star
22

here-devrel-workshops

TypeScript
2
star
23

phaser-mongodb-leaderboards-example

JavaScript
1
star
24

simple_mongodb_node_example

JavaScript
1
star
25

atlas-search-kotlin-example

Kotlin
1
star