Updated My Gem, omniauth-line
This article was automatically translated from Japanese by AI. Read the original Japanese version →
I updated my gem, omniauth-line.
The reason is as described in the PR below: an update to omniauth-oauth2 removed the callback_url method, so this class—which inherits from it—now needed to implement it itself.
I'm embarrassed to admit I have no idea what the backstory is behind callback_url being removed...
To be honest, not only do I no longer use this gem, I haven't even written Ruby in the past 2–3 years, so I'd been neglecting updates for a while. That said, I figured I really shouldn't leave it completely broken or depending on gems with security issues, so I finally got off my butt and updated it.
To actually release the update, though, I had to set up a working environment first, which turned out to be quite a hassle. After 2–3 years away from Ruby, I felt completely out of the loop—like Urashima Taro. When I was actively using it, Ruby 2.2 or 2.3 was the mainstream, and now 3.0 is the latest. Really makes you feel the passage of time.
Rails has progressed just as much, so setting up a full environment for that wasn't going to happen easily either. Installing Ruby on a Mac with rbenv goes smoothly enough, but Rails is a framework with a lot of moving parts just to boot up. It pulls in tons of gems right off the bat, plus plenty of native extensions.
So instead, I put together a Dockerfile that installs Ruby in Docker and spins up a Sinatra server. It feels a little questionable to verify a gem that almost everyone uses on Rails using Sinatra, but the core functionality should behave the same way, so good enough.
What it does is simple, though since OmniAuth's request_phase now only allows POST requests by default, you need to set up the form on the sample page accordingly.
get "/" do erb <<-"EOS" <form method='post' action='/auth/line'> <input type="hidden" name="authenticity_token" value='#{request.env["rack.session"]["csrf"]}'> <button type='submit'>Login with Line</button> </form> EOS end
https://github.com/kazasiki/test-omniauth-line/blob/master/app.rb#L17-L24
Beyond that, the Dockerfile just uses a Ruby 2.7 image to install the necessary gems, and docker-compose opens the required ports and runs the Sinatra startup command. Credentials and auth config are passed in via a .env file.
I don't know how many people are actually using omniauth-line, but sorry for the delayed update—and thank you to the contributor who sent in the PR.
