title: How to open original page after google oauth login using django social_auth
body: <p>I'm using django social_auth for user identification and it works great when user first login. However, if access token expired or directly open page by url, user will be redirect to a default page ('/') after google oauth. What should I do to get original page after google oauth login?</p>
  
  <p>Here is my settings.py:</p>
  
  <pre><code>INSTALLED_APPS = (
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'django_extensions',    
  'bootstrap3',
  'djangobower',
  'social_auth',
  )
  
  AUTHENTICATION_BACKENDS = (
      'social_auth.backends.google.GoogleOAuth2Backend',
      'django.contrib.auth.backends.ModelBackend',
  )
  
  SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/'
  GOOGLE_OAUTH2_CLIENT_ID = 'CLIENT_ID'
  GOOGLE_OAUTH2_CLIENT_SECRET = 'CLIENT_SECRET'
  SOCIAL_AUTH_USER_MODEL = 'auth.User'
  SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'
  GOOGLE_WHITE_LISTED_DOMAINS = ['google.com']
  
  SOCIAL_AUTH_GOOGLE_OAUTH2_AUTH_EXTRA_ARGUMENTS = {
      'access_type': 'offline',
      'approval_prompt': 'select_account+consent',
      'prompt' : 'select_account+consent'
  }
  </code></pre>
  
  <p>login.html:</p>
  
  <pre><code>{% load bootstrap3 %}
  {% load static %}
  &lt;link media="all" href="{% static 'bootstrap/dist/css/bootstrap.min.css' %}" type="text/css" rel="stylesheet"/&gt;
  &lt;script type="text/javascript" src='{% static 'bootstrap/dist/js/bootstrap.min.js' %}'&gt;&lt;/script&gt;
  {% load static %}    
  &lt;script type="text/javascript" src='{% static 'jquery/jquery.js' %}'&gt;&lt;/script&gt;
  &lt;link media="all" href="{% static 'dashboard.css' %}" type="text/css" rel="stylesheet"/&gt;
  &lt;script src='{% static 'canvasjs/canvasjs.min.js' %}' type="text/javascript"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" href="{% static 'signin.css' %}" /&gt; 
  
  {% if form.errors %}
  &lt;p text-align="center"&gt;Your username and password didn't match. Please try again. {{form.errors}} &lt;/p&gt;
  {% endif %}
  
  &lt;form method="post" action="{% url 'django.contrib.auth.views.login' %}" class="form-signin" role="form"&gt;
  {% csrf_token %}
  &lt;h2 class="form-signin-heading"&gt;ABC Website&lt;/h2&gt;
  &lt;input id="id_username" maxlength="254" name="username" type="text" class="form-control" placeholder="Username" autofocus/&gt;
  &lt;input id="id_password" name="password" type="password" class="form-control" placeholder="Password"/&gt;
  &lt;button class="btn btn-lg btn-primary btn-block" type="submit"&gt;System Account LogIn&lt;/button&gt;
  &lt;input type="hidden" name="next" value="{{ next }}" /&gt;
  &lt;/form&gt;
  
  &lt;p style="text-align: center"&gt;&lt;a href="{% url "socialauth_begin" "google-oauth2" %}?prompt=select_account+consent"&gt;GMail Login&lt;/a&gt;&lt;/p&gt;
  </code></pre>
  
  <p>urls.py:</p>
  
  <pre><code>url(r'^accounts/login/$', 'django.contrib.auth.views.login'),
  url(r'^accounts/logout/$', login_required(views.logout_view), name = "logout"),    
  url(r'^complete/(?P&lt;backend&gt;[^/]+)/$', views.AuthComplete.as_view()),
  url(r'^login-error/$', views.LoginError.as_view(), 'login-error'),
  url(r'', include('social_auth.urls')),    
  url(r'^admin/', include(admin.site.urls)),
  </code></pre>