Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
actions
assets
config
fixtures
grifts
locales
models
public
templates
.babelrc
.buffalo.dev.yml
.codeclimate.yml
.dockerignore
.gitignore
Dockerfile
README.md
database.yml
go.mod
go.sum
inflections.json
main.go
package.json
webpack.config.js
yarn.lock

README.md

Building Login with GitHub into your Buffalo App

Go in 5 Minutes, episode 29.

Welcome back to the Buffalo series! The last Buffalo episode we did was episode 25, where we talked about templating with templating with Plush.

Today, we're going to continue talking about frontend technologies and look at how to let your users log into your webapp with GitHub

We're going to be using the Goth library to do this, so I'll run through what that is, and then we'll look at the code for how to use it, and then we'll see it in action!

Check out the screencast for more!

How To Set Up Goth with buffalo-goth

With our Buffalo app created (I ran buffalo new episode29 to create this very app!), we can use plugins to customize it. In this episode, we're going to use the buffalo-goth plugin to write most of the code for us to implement GitHub auth.

These instructions are adapted from https://gobuffalo.io/en/docs/goth

First, get the buffalo-goth plugin for Buffalo. You'll only need to do this once, then you can re-use the plugin for all your Buffalo projects:

$ go get github.com/gobuffalo/buffalo-goth

The buffalo-goth executable is going to be put into $GOPATH/bin, so make sure that directory is in your PATH.

Next, generate the code for GitHub login:

$ buffalo generate goth github

You can pass more auth "providers" to the buffalo generate goth command. See here for a complete list of providers.

Show Notes

You can’t perform that action at this time.