https://github.com/david-uhlig/omniauth-rocketchat
Unofficial Rocket Chat strategy for OmniAuth
https://github.com/david-uhlig/omniauth-rocketchat
oauth2 omniauth omniauth-strategy rocketchat ruby ruby-on-rails
Last synced: 5 months ago
JSON representation
Unofficial Rocket Chat strategy for OmniAuth
- Host: GitHub
- URL: https://github.com/david-uhlig/omniauth-rocketchat
- Owner: david-uhlig
- License: mit
- Created: 2024-12-21T11:02:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-16T13:26:57.000Z (over 1 year ago)
- Last Synced: 2025-10-29T11:44:52.364Z (8 months ago)
- Topics: oauth2, omniauth, omniauth-strategy, rocketchat, ruby, ruby-on-rails
- Language: Ruby
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# OmniAuth Rocket Chat OAuth2 Strategy
[][gem]
[][license]
[][contributing]
[gem]: https://rubygems.org/gems/omniauth-rocketchat
[license]: LICENSE.md
[contributing]: CODE_OF_CONDUCT.md
Unofficial OmniAuth strategy to authenticate with [Rocket Chat](https://rocket.chat/) through OAuth2 in [OmniAuth](https://github.com/omniauth/omniauth).
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'omniauth-rocketchat'
```
Then execute `bundle install`.
## Rocket Chat Setup
You need to register your application with your Rocket Chat instance to obtain the `Client ID` and `Client Secret`. You will also need to add this applications host(s). This whitelists your application for the callback redirect. You can do this by following the steps below:
* Go to your Rocket Chat instance and login as an administrator.
* Go to `Administration` -> `Third-party login`.
* Click on `New Application`.
* Check the `Active` checkbox.
* Fill in the `Application Name` and `Redirect URL`. The redirect URL for devise looks like `https://example.com/users/auth/rocketchat/callback`. You can add multiple hosts by separating them with a comma.
* Click on `Save`.
* Select the third-party login you just created.
* Copy the `Client ID` and `Client Secret`.
## Integration
Pick one of the following methods to integrate the strategy with your application.
### Basic Usage
```ruby
use OmniAuth::Builder do
provider :rocketchat,
ENV["ROCKETCHAT_CLIENT_ID"],
ENV["ROCKETCHAT_CLIENT_SECRET"],
client_options: {
site: "https://example.com"
}
end
```
### With Custom Endpoints
```ruby
use OmniAuth::Builder do
provider :rocketchat,
ENV["ROCKETCHAT_CLIENT_ID"],
ENV["ROCKETCHAT_CLIENT_SECRET"],
client_options: {
site: "https://example.com",
authorize_url: "/custom/oauth/authorize",
token_url: "/custom/oauth/token"
}
end
```
### In Rails
```ruby
# config/initializers/rocketchat.rb
Rails.application.config.middleware.use OmniAuth::Builder do
provider :rocketchat,
ENV["ROCKETCHAT_CLIENT_ID"],
ENV["ROCKETCHAT_CLIENT_SECRET"],
client_options: {
site: "https://example.com"
}
end
```
### With Devise
```ruby
# config/initializers/rocketchat.rb
Devise.setup do |config|
config.omniauth :rocketchat,
ENV["ROCKETCHAT_CLIENT_ID"],
ENV["ROCKETCHAT_CLIENT_SECRET"],
client_options: {
site: "https://example.com"
}
end
```
## Configuration
* The `client_options` options: `authorize_url` and `token_url` are optional and default to `/oauth/authorize` and `/oauth/token` respectively.
* `scope` has no effect on Rocket Chat. Users grant you full permissions to their account. Handle responsibly!
## Versioning
This library aims to adhere to [Semantic Versioning 2.0.0](http://semver.org/). Violations of this scheme should be reported as bugs.
## Contributing
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
Bug reports and pull requests are welcome on the [GitHub project page](https://github.com/david-uhlig/omniauth-rocketchat).
## License
Copyright © 2024-2025 David Uhlig. See [LICENSE][] for details.