Skip to content

Instantly share code, notes, and snippets.

@JStans12
Last active February 8, 2017 22:33
Show Gist options
  • Save JStans12/87ac08639260efe502bfa0c294a13b7c to your computer and use it in GitHub Desktop.
Save JStans12/87ac08639260efe502bfa0c294a13b7c to your computer and use it in GitHub Desktop.

Register an Application to use OAuth with Census

Census uses Devise and Doorkeeper to manage authentication.

Gems

Currently, there are 2 gems to help you set up OAuth, one for staging and one for production. Soon, we will add a configuation option so you don't need to change your gemfile before pushing to production.

Common Issues

  • HTTPS

    • Census only allows authentication from a secure connection. This won't be a problem on a Heroku server, but it's a bit of a headache on localhost. In order to test OAuth locally, you need to create an ssl certificate and run a local server "securly." Luckily, Nick Martinez wrote a great tutorial to make this work in the "Important Stuff" section of the oauth staging gem.
  • Expiring Tokens

    • Be aware that tokens expire every 90 days. Doorkeeper provides a way to grab a refresh token so your session isn't interupted.

Roles

Some roles are just a flag for querying, others define your permissions on the site. Below is a list of all the currently available roles.
Note that the staging server is messy and roles may be incorrect for some users. Contact an admin if you need to change your permissions.

Permissions

  • Admin

    • Can crud all aspects of users.
    • Can manage applications
  • Staff / Active Student / Graduated / Mentor

    • Can read and update their own personal info.
    • Can join public groups.
    • Can read cohort information (view cohort pages).
    • Can manage applications
  • Enrolled

    • Can read and update their own personal info.
    • Can read cohort information (view cohort pages).
  • Exited / Removed

    • Can't do anything

Flags

  • Instructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment