Skip to content

Instantly share code, notes, and snippets.

@f3r3nc
Last active August 29, 2015 14:07
Show Gist options
  • Save f3r3nc/aa4e0cfb43b7c288ea56 to your computer and use it in GitHub Desktop.
Save f3r3nc/aa4e0cfb43b7c288ea56 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script src="https://apis.google.com/js/client:platform.js" async defer></script>
</head>
<body>
<div id="signinButton">
<span class="g-signin"
data-scope="{{ plus_scope }}"
data-clientid="{{ plus_id }}"
data-redirecturi="postmessage"
data-accesstype="offline"
data-cookiepolicy="single_host_origin"
data-callback="signInCallback">
</span>
</div>
<form id="google-plus" method="post" action="{% url 'social:complete' "google-plus" %}">
{% csrf_token %}
<input id="at" type="hidden" name="access_token" value="" />
<input id="code" type="hidden" name="code" value="" />
</form>
<script type="text/javascript">
var signInCallback = function (result) {
$('#code').attr('value', result['code']);
$('#at').attr('value', result['access_token']);
$('#google-plus').submit();
}
};
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment