Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Dropbox dependency to 9.9.0 and support new promise based urls #163

Merged
merged 1 commit into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions examples/browser.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@
<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/dropbox-oauth-popup@2.0.1/dist/dropboxPopup.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dropbox-oauth-popup@3.0.0/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, this is just a demo.)
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,
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>
<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>
Expand All @@ -27,6 +24,7 @@ <h1>Dropbox OAuth Popup Window</h1>
clientSecret: 'tbjemcamktbyiy9',
redirectUri: 'https://rogebrd.github.io/dropbox-oauth-popup/tutorial-browser.html'
});

function runAuth() {
document.getElementById("result").innerHTML = "Waiting for auth...";
popup.authUser().then((auth) => {
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dropbox-oauth-popup",
"version": "2.0.2",
"version": "3.0.0",
"registry": "npm",
"description": "This is a simple addition built onto the Dropbox SDK that allows for OAuth in the browser to be done via a popup window.",
"homepage": "https://github.com/rogebrd/dropbox-oauth-popup",
Expand Down Expand Up @@ -30,7 +30,7 @@
"rollup-plugin-terser": "^7.0.2"
},
"dependencies": {
"dropbox": "^7.0.0"
"dropbox": "^9.8.0"
},
"browserslist": [
"> 0.25%",
Expand Down Expand Up @@ -58,4 +58,4 @@
"front-end",
"window"
]
}
}
10 changes: 6 additions & 4 deletions src/dropboxPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ export default class DropboxPopup {
});
}

const authUrl = popup.authObject.getAuthenticationUrl(popup.redirectUri, popup.state, 'code', popup.tokenAccessType, popup.scope, popup.includeGrantedScopes, popup.usePKCE);
const popupWindow = window.open(authUrl, windowName, popup.windowOptions);
popupWindow.focus();
window.addEventListener('message', handleRedirect, false);
popup.authObject.getAuthenticationUrl(popup.redirectUri, popup.state, 'code', popup.tokenAccessType, popup.scope, popup.includeGrantedScopes, popup.usePKCE)
.then((authUrl) => {
const popupWindow = window.open(authUrl, windowName, popup.windowOptions);
popupWindow.focus();
window.addEventListener('message', handleRedirect, false);
});
});
}
}