<button id='login' onclick='oauthSignIn();' class='button-7'>Login</button> <script> /* * Create form to request access token from Google's OAuth 2.0 server. */ /* * Create form to request access token from Google's OAuth 2.0 server. */ function oauthSignIn() { // Google's OAuth 2.0 endpoint for requesting an access token var oauth2Endpoint = 'https://accounts.google.com/o/oauth2/v2/auth'; // Create <form> element to submit parameters to OAuth 2.0 endpoint. var form = document.createElement('form'); form.setAttribute('method', 'GET'); // Send as a GET request. form.setAttribute('action', oauth2Endpoint); // Parameters to pass to OAuth 2.0 endpoint. var params = {'client_id': '1009850978980-sf789hjqbvk96nsti4oebpboec67oa5q.apps.googleusercontent.com', 'redirect_uri': 'https://storehaccounts.blogspot.com', 'response_type': 'token', 'scope': 'https://www.googleapis.com/auth/blogger', 'include_granted_scopes': 'true', 'state': 'pass-through value'}; // Add form parameters as hidden input values. for (var p in params) { var input = document.createElement('input'); input.setAttribute('type', 'hidden'); input.setAttribute('name', p); input.setAttribute('value', params[p]); form.appendChild(input); } // Add form to page and submit it to open the OAuth 2.0 endpoint. document.body.appendChild(form); form.submit(); } </script>