diff --git a/app/controllers/redmine_oauth_controller.rb b/app/controllers/redmine_oauth_controller.rb
index 4ac8bce51fec2ca814cb943a72797c82a286cf05..0efac4c8c70e9acb6133ce90c2512e5d619a1cab 100644
--- a/app/controllers/redmine_oauth_controller.rb
+++ b/app/controllers/redmine_oauth_controller.rb
@@ -6,6 +6,7 @@ class RedmineOauthController < AccountController
   include Helpers::Checker
   def oauth_google
     if Setting.plugin_redmine_omniauth_google[:oauth_authentification]
+      session[:back_url] = params[:back_url]
       redirect_to oauth_client.auth_code.authorize_url(:redirect_uri => oauth_google_callback_url, :scope => scopes)
     else
       password_authentication
@@ -30,6 +31,8 @@ class RedmineOauthController < AccountController
   end
 
   def try_to_login info
+   params[:back_url] = session[:back_url]
+   session.delete(:back_url)
    user = User.find_or_initialize_by_mail(info["email"])
     if user.new_record?
       # Self-registration off
diff --git a/app/views/hooks/_view_account_login_bottom.html.erb b/app/views/hooks/_view_account_login_bottom.html.erb
index 3f35344172495d0189e491753c9fe0476562d77d..4c8a243a22a3909a37e15a1bf6e11f43c3130213 100644
--- a/app/views/hooks/_view_account_login_bottom.html.erb
+++ b/app/views/hooks/_view_account_login_bottom.html.erb
@@ -1,7 +1,7 @@
 <%= stylesheet_link_tag 'buttons', :plugin => 'redmine_omniauth_google' %>
 
 <% if Setting.plugin_redmine_omniauth_google[:oauth_authentification] %>
-  <%= link_to oauth_google_path do %>
+  <%= link_to oauth_google_path(:back_url => back_url) do %>
     <%= button_tag :class => 'button-login' do %>
       <%= image_tag('/plugin_assets/redmine_omniauth_google/images/google_login_icon.png', :class => 'button-login-icon', :alt => l(:login_via_google)) %>
       <%= content_tag :div, l(:login_via_google), :class => 'button-login-text' %>