lib/prx_auth/rails/ext/controller.rb in prx_auth-rails-2.1.0 vs lib/prx_auth/rails/ext/controller.rb in prx_auth-rails-3.0.0
- old
+ new
@@ -114,10 +114,11 @@
ids.map { |id| session[PRX_ACCOUNT_MAPPING_SESSION_KEY][id] }
end
def fetch_accounts(ids)
ids_param = ids.map(&:to_s).join(',')
- fetch("/api/v1/accounts?account_ids=#{ids_param}")['accounts']
+ resp = fetch("/api/v1/accounts?account_ids=#{ids_param}")
+ resp.try(:[], '_embedded').try(:[], 'prx:items') || []
end
def fetch_userinfo
fetch("/userinfo?scope=apps+email+profile", prx_jwt)
end