This repo contains a Rails API Framwork with PostGres and an Angular Client. Only the necessary gems/packages have been added to make Device/OAuth2 work together, everything else is untouched. I hope you'll find this helpful in getting a decoupled application going, especially the decioupled auth. Please report any bugs you find through pull request, thank you!!
Basic Rails API install with a Postgresql database. Only the necessary gems/code have been added to make Device/OAuth2 work, everything else is untouched.
This was also left as bare bones as possible and only includes the necessary code/scripts to work with Device/OAuth/RailsAPI.
<html lang='en' ng-app='yourAppName'>yourAppName can be changed to...your apps name
<body ng-controller='mainCtrl'></body>mainCtrl can be changed but not necessary
<button ng-click="authenticate('google')">'google' can be replaced with the OAuth provider of your choice
angular.module('yourAppName', ['ng-token-auth']);yourAppName should match the app name you set in the HTML tag of index.html
var yourAppon line one, line 3, and line 9 can be changed to whatever you like.
$auth.authenticate('google')Google can be replaced with the OAuth Provider of choice - see https://github.com/lynndylanhurley/ng-token-auth#api
From your rails api directory use the standard
From terminal in your Angular root directory, you can simply use python to serve the index.thml
python -m SimpleHTTPServer 9393
You need to configured your OAuth Provider for keys (google, fb, twitter) and setup your redirect from their site (see "OmniAuth provider settings” in https://github.com/lynndylanhurley/devise_token_auth )
In your rails API, when you move to Production you MUST change
origins '*' resource '*' in your /config/application.rb to be the address of your Client Server otherwise anyone can hit your API
Any questions for the rails-api devise/oauth go to: https://github.com/lynndylanhurley/devise_token_auth
Any questions for the Angular devise/oauth go to: https://github.com/lynndylanhurley/ng-token-auth
I take absolutely no responsibility for this working well or terribly in your application. You should have a general understanding of what this code is doing and use the resources linked above to understand the Devise Token Auth and ng_Auth.
Module stats last updated: 2015-06-28 11:04:52