A Ruby project that demonstrates how to perform authentication and authorization via crossid.
- Have a Crossid tenant, or sign up for free.
- Add a web application
First, install dependencies (if up to date dependencies are crucial, you should remove Gemfile.lock):
bundler
Depending or your env, you'll might need to install ruby-development, for example (depending on distro):
sudo apt-get install ruby-dev
sudo yum install ruby-devel
sudo zypper install ruby-devel
Then you can run the server with rackup:
CLIENT_ID=<client_id>\
CLIENT_SECRET=<client_secret> \
REDIRECT_URI=http://localhost:9292/callback \
ISSUER_BASE_URL=https://<tenant_id>.<region>.crossid.io/oauth2/ \
rackup
Depending on your "rack" version, you might need to run "bundle exec rackup"
Click this button to deploy the app to the DigitalOcean App Platform.
Note: when creating the web app, put a temporary URLs in Redirect URI and Logout URI until the app is deployed.
Fill the needed environment variables: ISSUER_BASE_URL
, CLIENT_ID
and CLIENT_SECRET
.
Or if you have doctl
installed then run:
doctl apps create --spec .do/app.yaml
Then go to the DigitalOcean admin screen and update the environment variables as stated above.
Take note of the public url of your new app. (replace {public_url} below with the public url)
Finally, go to CrossID admin screen, edit the oauth2 client, and add the correct callback url: {public_url}/callback
and to post logout redirect uris as: {public_url}