Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix: check if app exists

  • Loading branch information...
commit 7a89506a4351851a1fb8f247e19893625ad9d590 1 parent 7fe6b79
Jesse Stuart jvatic authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 lib/omniauth/strategies/tent.rb
11 lib/omniauth/strategies/tent.rb
View
@@ -71,7 +71,16 @@ def perform_discovery!
def find_or_create_app!
app = Hashie::Mash.new(options[:get_app].call(get_state(:entity)) || {})
- app[:id] ? set_app(app) : create_app
+ client = ::TentClient.new(get_state(:server_url), :mac_key_id => app[:mac_key_id],
+ :mac_key => app[:mac_key],
+ :mac_algorithm => app[:mac_algorithm])
+ if app[:id]
+ res = client.app.get(app[:id])
+ return create_app if res.body.kind_of?(::String)
+ set_app(res.body)
+ else
+ create_app
+ end
end
def set_app(app)
Please sign in to comment.
Something went wrong with that request. Please try again.