Using Überauth for authentication in Phoenix.
This project demonstrates how to use Überauth and multiple strategies to provide authentication for a Phoenix application. The project has been setup to run on Heroku can can be found at ueberauth-example.herokuapp.com.
In this example we'll use three strategies:
- Facebook (ueberauth_facebook)
- GitHub (ueberauth_github)
- Google (ueberauth_google)
-
Retrieve app ids and secrets and set environment variables:
- Facebook (https://developers.facebook.com)
- FACEBOOK_APP_ID
- FACEBOOK_APP_SECRET
- GitHub (https://developer.github.com)
- GITHUB_CLIENT_ID
- GITHUB_CLIENT_SECRET
- Facebook (https://developers.facebook.com)
- Google (https://console.developers.google.com/home)
- GOOGLE_CLIENT_ID
- GOOGLE_CLIENT_SECRET
-
Clone the project:
$ git clone [email protected]:ueberauth/ueberauth_example.git $ cd ueberauth_example
-
Fetch dependecies:
$ mix deps.get
-
Run server:
$ mix phoenix.server
-
Authenticate at http://localhost:4000!
See Überauth for detailed instructions.
Contributions are welcomed and encouraged. Please make appropriate use of Issues and Pull Requests.
The MIT License (MIT)
Copyright (c) 2015 Sean Callan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.