def sign_in_success
      g_user = signed_in?

      if g_user
        user = {
          :email => g_user.email,
          :user_id => g_user.user_id,
          :name => g_user.name,
          :photo_url => g_user.photo_url,
          :provider_id => g_user.provider_id
        }

        @user = User.find_by(user_id: user[:user_id])

        if @user.nil?
          @user = User.create user
        else
          @user.update user
        end

        session[:user] = @user.id

        if session[:previous_url]
          previous_url = session[:previous_url]
          session.delete :previous_url
          redirect_to previous_url
        else
          redirect_to main_app.root_url
        end
      else
        @user = false
        session.delete :user

        flash.alert = "Sign in failed. Please try again."
        redirect_to gitkit_sign_in_url
      end
    end
def sign_in_success
      g_user = signed_in?

      if g_user
        user = {
          :email => g_user.email,
          :user_id => g_user.user_id,
          :name => g_user.name,
          :photo_url => g_user.photo_url,
          :provider_id => g_user.provider_id
        }

        @user = User.find_by(user_id: user[:user_id])

        if @user.nil?
          @user = User.create user
        else
          @user.update user
        end

        session[:user] = @user.id

        if session[:previous_url]
          previous_url = session[:previous_url]
          session.delete :previous_url
          redirect_to previous_url
        else
          redirect_to main_app.root_url
        end
      else
        @user = false
        session.delete :user

        flash.alert = "Sign in failed. Please try again."
        redirect_to gitkit_sign_in_url
      end
    end
This will be called after successfull signin