This is the official OmniAuth strategy for authenticating to TeamSnap. To use it, you'll need to sign up for an OAuth2 Application Id and Secret on Cogsworth.
use OmniAuth::Builder do
provider :teamsnap, ENV['TEAMSNAP_KEY'], ENV['TEAMSNAP_SECRET']
end
TeamSnap API v3 lets you set scopes to provide granular access to different types of data:
use OmniAuth::Builder do
provider :teamsnap, ENV['TEAMSNAP_KEY'], ENV['TEAMSNAP_SECRET'], scope: "read write"
end
An example auth hash available in request.env['omniauth.auth']
:
{
:provider => "teamsnap",
:uid => "123456",
:info => {
:email => "player@example.com",
:first_name => "John",
:last_name => "Player",
},
:credentials => {
:token => "a1b2c3d4...", # The OAuth 2.0 access token
},
:extra = {}
}
docker build . -t omniauth-teamsnap:test -f Test.dockerfile
docker run -t omniauth-teamsnap:test
docker image rm omniauth-teamsnap:test --force