Git Product home page Git Product logo

passport's Introduction

passport

Centralized authentication and user information for RDC operations. To use this, you need to request a clientID & secret from morgante.

OAuth

Authentication is done via OAuth, with these endpoints:

  • Authorization endpoint: http://passport.sg.nyuad.org/visa/oauth/authorize
  • Token enddpoint/exchange: http://passport.sg.nyuad.org/visa/oauth/token

Current User

Once authorized, you can request profile information on the currently authed user from the endpoint http://passport.sg.nyuad.org/visa/use/info/me. This must be passed an authorization code (a standard OAuth authenticaed token). It will return a profile.

Profiles

You can also request information on any user through the endpoint http://passport.sg.nyuad.org/api/info/profile/net9238?client=YOURCLIENTHERE&secret=YOURSECRETHERE.

If the user is a valid NYUAD user, it will return a profile such as:

{
  "netID": "mp3255",
  "name": "Morgante Pell",
  "groups": [
    "nyuad2016",
    "nyuad"
  ]
}

If the user is not valid, you will receive an error:

{
  "type": "user.notexist",
  "message": "user does not exist"
}

Provider Tokens

Passport authenticates with other services, primarily Google. If your application has the proper scopes, it can receive an access token to access those services.

To get an access token for Google, GET here: http://passport.sg.nyuad.org/visa/google/token?access_token=YOURTOKENHERE, using the access token you obtained for Passport. Please note this token will always be up to date (we handle refreshing it).

This might respond with an error that the user hasn't delegated the necessary scopes from Google, in which case you should redo the authentication flow with Passport.

Github

You can also request authentication tokens for GitHub. First request that scope from the Passport Administrator. You can then get GitHub auth tokens from this endpoing: http://passport.sg.nyuad.org/visa/github/token?access_token=YOURTOKENHERE. It will return results like this:

{
  "access_token": "somethingsecurehere",
  "profile": {
    "provider": "github",
    "id": 1627801,
    "displayName": "Morgante Pell",
    "username": "morgante",
    "profileUrl": "https://github.com/morgante",
    "emails": [
      {
        "value": "[email protected]"
      }
    ]
  }
}

Logout

If you provide a logout button in your application, you might consider propogating that logout action down the stack to Passport & NYU. To do so, just direct the user (with a redirect or link) to http://passport.sg.nyuad.org/auth/logout.

passport's People

Contributors

morgante avatar joejean avatar

Watchers

James Cloos 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.