Skip to content

Commit 12c66f4

Browse files
Merge branch 'google:master' into junit-5-tests-for-oauth
2 parents e98e045 + 85c6b4f commit 12c66f4

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

go/sendgmail/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ send-email`.
2222
* Follow the steps in the **Authorize credentials for a desktop
2323
application** section. However, set the application type to *Web
2424
application* (i.e. instead of *Desktop app*) and then add
25-
`https://oauth2.dance/` as an authorised redirect URI. This is necessary
26-
for seeing the authorisation code on a page in your browser.
25+
`https://google.github.io/gmail-oauth2-tools/html/oauth2.dance.html`
26+
as an authorised redirect URI. This is necessary for seeing the
27+
authorisation code on a page in your browser.
2728

2829
* When you download the credentials as JSON, create the
2930
`${XDG_CONFIG_HOME:-${HOME}/.config}/sendgmail` directory with file mode

html/oauth2.dance.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<meta name="viewport" content="width=device-width, initial-scale=1">
4+
<style>:root { color-scheme: dark light; }</style>
5+
<title>oauth2.dance</title>
6+
<h1>oauth2.dance</h1>
7+
<div id="authCodeDivFailure" style="display: none;">
8+
These aren't the droids you're looking for.
9+
</div>
10+
<div id="authCodeDivSuccess" style="display: none;">
11+
Authorisation Code:
12+
<span id="authCodeSpan" style="font-family: monospace; font-weight: bold;"></span>
13+
<br>
14+
<button id="authCodeButton">Copy To Clipboard</button>
15+
</div>
16+
<script>
17+
var searchParams = new URLSearchParams(window.location.search);
18+
var code = searchParams.get("code");
19+
if (code === null) {
20+
var div = document.getElementById("authCodeDivFailure");
21+
div.style = "";
22+
} else {
23+
var button = document.getElementById("authCodeButton");
24+
button.addEventListener("click", (e) => { navigator.clipboard.writeText(code); });
25+
var span = document.getElementById("authCodeSpan");
26+
span.textContent = code;
27+
var div = document.getElementById("authCodeDivSuccess");
28+
div.style = "";
29+
}
30+
</script>

python/oauth2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
registering and for documentation of the APIs invoked by this code.
2323
2424
NOTE: The OAuth2 OOB flow isn't a thing anymore. You will need to set the
25-
application type to "Web application" and then add https://oauth2.dance/ as an
25+
application type to "Web application" and then add
26+
https://google.github.io/gmail-oauth2-tools/html/oauth2.dance.html as an
2627
authorised redirect URI. This is necessary for seeing the authorisation code on
2728
a page in your browser.
2829
@@ -134,7 +135,7 @@ def SetupOptionParser():
134135

135136

136137
# Hardcoded redirect URI.
137-
REDIRECT_URI = 'https://oauth2.dance/'
138+
REDIRECT_URI = 'https://google.github.io/gmail-oauth2-tools/html/oauth2.dance.html'
138139

139140

140141
def AccountsUrl(command):

0 commit comments

Comments
 (0)