13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/shopify_app/sessions_concern.rb', line 13
def callback
if response = request.env['omniauth.auth']
shop_name = response.uid
token = response['credentials']['token']
sess = ShopifyAPI::Session.new(shop_name, token)
session[:shopify] = ShopifyApp::SessionRepository.store(sess)
session[:shopify_domain] = shop_name
WebhooksManager.queue(shop_name, token) if ShopifyApp.configuration.has_webhooks?
ScripttagsManager.queue(shop_name, token) if ShopifyApp.configuration.has_scripttags?
flash[:notice] = I18n.t('.logged_in')
redirect_to_with_fallback return_address
else
flash[:error] = I18n.t('could_not_log_in')
redirect_to_with_fallback login_url
end
end
|