I don't know about that Ruby/Gem, but your app registration is not correct.
You need to configure your app for explicit OAuth2, per this other answer, except enter localhost instead of example.com.
(The localhost is based on the original version of the question. If you have a registered domain, use that.)
Then, in your ruby code:
I don't think that's a bug, for implicit OAuth. Anyway, if I understand RFC 6749 correctly, that is not how you are supposed to do such extra checks.
Use the state parameter. And this works.
For example, a call to:
(Click the link and try it.)
Refer to the API Authentication docs; there are a great many things wrong with the URL in the question (at least 5).
For starters, it's to the wrong path. stackoverflow.com/oauth/authorize gives helpful messages/results like:
Oops! Something Bad Happened!
Authorization attempt not valid for current user
Authorization attempt unauthorized
I get the reason:
Do not use gem 'omniauth-stackexchange', '~> 0.2.1' ,but instead of gem 'omniauth-stackexchange', git: 'https://github.com/nashby/omniauth-stackexchange.git'
The reason see this:add call back url