-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
131 additions
and
11 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
dist/ | ||
dist/ | ||
docs/ |
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
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,47 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/dropbox/dist/Dropbox-sdk.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/dropboxPopup.js"></script> | ||
</head> | ||
|
||
<body> | ||
<div> | ||
<h1>Dropbox OAuth Popup Window</h1> | ||
<p> | ||
See the Dropbox OAuth Popup Window in action by clicking the run example button. | ||
This example will authenticate with your Dropbox account and use the token to fetch | ||
the current account using the `users.getCurrentAccount` endpoint. (Note, nothing is | ||
saved on our end, this is just a demo.) | ||
</p> | ||
<p>See the code on <a | ||
href="https://github.com/rogebrd/dropbox-oauth-popup/blob/main/examples/browser.html">GitHub</a></p> | ||
<button onclick="runAuth()">Run Example</button> | ||
<p id="result"></p> | ||
<script> | ||
const popup = new DropboxPopup({ | ||
clientId: 'a04f1ghft6a45rn', | ||
clientSecret: 'tbjemcamktbyiy9', | ||
redirectUri: 'https://rogebrd.github.io/dropbox-oauth-popup/tutorial-browser.html' | ||
}); | ||
function runAuth() { | ||
document.getElementById("result").innerHTML = "Waiting for auth..."; | ||
popup.authUser((auth) => { | ||
const dbx = new Dropbox.Dropbox(auth); | ||
dbx.usersGetCurrentAccount() | ||
.then((response) => { | ||
document.getElementById("result").innerHTML = response.result; | ||
}) | ||
.catch((error) => { | ||
document.getElementById("result").innerHTML = error; | ||
}); | ||
}); | ||
} | ||
</script> | ||
</div> | ||
</body> | ||
|
||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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