Skip to content

Instantly share code, notes, and snippets.

@dzmitryk
Last active October 27, 2015 08:27
Show Gist options
  • Save dzmitryk/0a75b6ccde2bcaa77d44 to your computer and use it in GitHub Desktop.
Save dzmitryk/0a75b6ccde2bcaa77d44 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>OAuth code</title>
</head>
<body>
<div>
<label for="code">Your authorization code is:</label>
<b><span id="code"></span></b>
</div>
<script language="javascript" type="text/javascript">
var pattern = /[?|&]code=[^&]*/;
var codeElement = document.getElementById('code');
pattern.test(document.URL) ?
codeElement.innerHTML = pattern.exec(document.URL)[0].substring(6) : codeElement.innerHTML = 'No code specified';
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment