Git Product home page Git Product logo

angular-nebri-authentication's Introduction

Angular Nebri Authentication

The simple and easy-to-use package for making authenticated Nebri api requests from a Angular application.

This app is intended for use with a Nebri instance. Visit https://nebrios.com to sign up for free!

Installation

Copy any/all of the js files to the appropriate location in your application. The location(s) should be added to the index or base html page. ``` <script src="path/to/nebri-angular-token-auth.js"></script> <script src="path/to/nebri-angular-basic-auth.js"></script> <script src="path/to/nebri-angular-oauth.js"></script> ```

Requirements

This app requires the use of https://github.com/nebrie/angular-nebri.

NOTE: Before using any classes and associated functions in this package, you must include nebrios-authentication in your Nebri Instance and set up any authentication methods you would like to utilize. See https://github.com/nebrie/nebrios-authentication/blob/master/README.md for more information.

Setup

Depending on what authentication schema you would like to use, apps should be added to your dependencies. In app.js, nebriAngularTokenAuth/nebriAngularBasicAuth/nebriAngularOAuth should be added to your dependencies. The config section should be updated as well to include your credentials. ``` angular.module('myApp', [ ..., 'nebriAngular', 'nebriAngularTokenAuth', 'nebriAngularOAuth', 'nebriAngularBasicAuth' ]). config([..., 'nebriAngularProvider', 'nebriAngularTokenAuthProvider', 'nebriAngularOAuthProvider', 'nebriAngularBasicAuthProvider', function(..., nebriAngularProvider, nebriAngularTokenAuthProvider, nebriAngularOAuthProvider, nebriAngularBasicAuthProvider) { nebriAngularProvider.setInstanceName('instance_name'); nebriAngularTokenAuthProvider.setToken('token'); nebriAngularOAuthProvider.setCredentials('consumer_key', 'consumer_secret'); nebriAngularBasicAuthProvider.setCredentials('username', 'password'); }]); ``` - all credentials should be set up on your Nebri instance before using these methods. See https://github.com/briem-bixly/nebrios-authentication

Public Function

api_request - api_module: the name of the api module stored on your Nebri instance - view_name: the name of the target function contained in the given api module - method: the desired HTTP request method - payload: an object containing params and values, can be set to null

Usage Example

``` .controller('myController', function(..., nebriAngularTokenAuth, nebriAngularBasicAuth, nebriAngularOAuth){ var token_request = nebriAngularTokenAuth.api_request('nebrios_authentication', 'test_token', 'post'); token_request.then( function(data){ console.log(data); }, function(err){ console.log(err); }); var basic_request = nebriAngularBasicAuth.api_request('nebrios_authentication', 'test_basic', 'post'); basic_request.then( function(data){ console.log(data); }, function(err){ console.log(err); }); var oauth_request = nebriAngularOAuth.api_request('nebrios_authentication', 'another_test', 'post'); oauth_request.then( function(data){ console.log(data); }, function(err){ console.log(err); }); }); ``` - For all classes, promises are utilized to ensure all credentials are available before any calls are made. For nebriAngularOAuth, any calls that are created before an access token has be generated and saved are queued and sent once the access token has been returned properly.

angular-nebri-authentication's People

Contributors

nebrie avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.