-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: default redirect when
use_local_webserver = False
(#62)
* add oauth logic and webapp default handling * updates logic * feat: adds decision logic to handle multiple oauth use cases * lint the files and remove f-string
- Loading branch information
1 parent
1d55d53
commit 41852ce
Showing
4 changed files
with
104 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
function onloadoauthcode() { | ||
const PARAMS = new Proxy(new URLSearchParams(window.location.search), { | ||
get: (searchParams, prop) => searchParams.get(prop), | ||
}); | ||
const AUTH_CODE = PARAMS.code; | ||
|
||
document.querySelector('.auth-code').textContent = AUTH_CODE; | ||
|
||
setupCopyButton(document.querySelector('.copy'), AUTH_CODE); | ||
} | ||
|
||
function setupCopyButton(button, text) { | ||
button.addEventListener('click', () => { | ||
navigator.clipboard.writeText(text); | ||
button.textContent = "Verification Code Copied"; | ||
setTimeout(() => { | ||
// Remove the aria-live label so that when the | ||
// button text changes back to "Copy", it is | ||
// not read out. | ||
button.removeAttribute("aria-live"); | ||
button.textContent = "Copy"; | ||
}, 1000); | ||
|
||
// Re-Add the aria-live attribute to enable speech for | ||
// when button text changes next time. | ||
setTimeout(() => { | ||
button.setAttribute("aria-live", "assertive"); | ||
}, 2000); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.. image:: https://lh3.googleusercontent.com/n4u3LcbRm3yvTK-EzYqGGtqHBf83KnfY14-3z9mIPRCrIKv-K4ieqJVLYl-yVM7H5EM | ||
:alt: pydata logo | ||
:class: logo | ||
|
||
Sign in to BigQuery | ||
=================== | ||
|
||
You are seeing this page because you are attempting to access BigQuery via one | ||
of several possible methods, including: | ||
|
||
* the ``pydata-google-auth`` library | ||
|
||
OR a ``pandas`` library helper function such as: | ||
|
||
* ``pandas.DataFrame.to_gbq()`` | ||
* ``pandas.read_gbq()`` | ||
|
||
from this or another machine. If this is not the case, close this tab. | ||
|
||
Enter the following verification code in the CommandLine Interface (CLI) on the | ||
machine you want to log into. This is a credential **similar to your password** | ||
and should not be shared with others. | ||
|
||
|
||
.. raw:: html | ||
|
||
<script type="text/javascript"> | ||
window.addEventListener( "load", onloadoauthcode ) | ||
</script> | ||
|
||
<div> | ||
<code class="auth-code"></code> | ||
</div> | ||
<br> | ||
<button class="copy" aria-live="assertive">Copy</button> | ||
|
||
.. hint:: | ||
|
||
You can close this tab when you’re done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters