GithubHelp home page GithubHelp logo

codefly / dpd-passport Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simpletechs/dpd-passport

0.0 2.0 0.0 135 KB

GitHub clone of https://bitbucket.org/simpletechs/dpd-passport w/GitHub support

License: Other

JavaScript 100.00%

dpd-passport's Introduction

Auth-Passport Resource

This custom resource type allows you to authorize your users using the powerful Passport. Currently, the following methods are supported for authentification:

  • local (i.e. username + password)
  • Twitter (using Api v1.1)
  • Facebook (using OAuth)
  • GitHub
  • Google

Others can be implemented easily if Passport supports them.

Requirements

  • deployd (you'd have guessed that, probably :-))
  • User-Collection named users with at least these custom fields:
    {
        "socialAccount": {
            "name": "socialAccount",
            "type": "string",
            "typeLabel": "string",
            "required": false,
            "id": "socialAccount",
            "order": 0
        },
        "socialAccountId": {
            "name": "socialAccountId",
            "type": "string",
            "typeLabel": "string",
            "required": false,
            "id": "socialAccountId",
            "order": 1
        },
        "profile": {
            "name": "profile",
            "type": "object",
            "typeLabel": "object",
            "required": false,
            "id": "profile",
            "order": 2
        },
        "name": {
            "name": "name",
            "type": "string",
            "typeLabel": "string",
            "required": false,
            "id": "name",
            "order": 3
        }
    }

Installation

In your app's root directory, type npm install dpd-passport into the command line or download the source. This should create a dpd-passport directory in your app's node_modules directory.

See Installing Modules for details.

Setup

Open your Dashboard and add the new Passport-Auth Resource. Then configure which modules you want to allow for your users and supply the required information for each module.

Note: You may supply the baseURL (your website's root) via the environment variable DPD_PASSPORT_BASEURL. This is especially useful when you have a single codebase for testing + production environments.

Usage

Point your users to /auth/{login,twitter,facebook,github,google} to have them login (or signup) via the specified module. After that, Auth-Passport completely takes over and redirects the users according to the OAuth(2) flow.

Usage in Mobile Apps

Auth-Passport was built with usage in mobile Apps in mind. From inside your mobile app, open a browser and point the user to your website's /auth/{login,twitter,facebook,github} endpoint. From there, Auth-Passport will take over and guide (i.e. redirect) your user through the different steps needed for each provider, until the user has authorized your app and logged in successfully.

Now you can get hold of your user and his session, by specifying a redirectURL in the original request. After the login is done (no matter if it was successful or not), your user will be redirected to the specified URL. Supply some app-specific URL (see your platform's SDK on how that looks) and catch the response in your app. Auth-Passport will supply the following information:

  • sid (String) Session ID in deployd, send this in every subsequent request
  • uid (String) User ID of the user that just logged in
  • success (Bool) true, if login was successfull
  • error (String) contains the error message in case of an error

Development

To get started with development, please fork this repository and make your desired changes. Please note that we do all our dev work on bitbucket, so while you may submit pull requests on github, we will only push releases to github once they are finished.

Credits

We'd like to thank Passport for building this amazing auth-framework!

Auth-Passport is the work of simpleTechs.net

Contributors

The following people contributed some of there valuable spare time to make this module even better. Please add yourself to the list, in case we forgot you.

dpd-passport's People

Contributors

0ff avatar tmcnab 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.