Skip to content

Commit 8f18c6d

Browse files
authored
Upgrade Dropbox dependency to 9.9.0 and support new promise based urls (#163)
1 parent cfc780e commit 8f18c6d

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

examples/browser.html

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,17 @@
55
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@7/dist/polyfill.min.js"></script>
66
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.js"></script>
77
<script src="https://cdn.jsdelivr.net/npm/dropbox/dist/Dropbox-sdk.js"></script>
8-
<script src="https://cdn.jsdelivr.net/npm/dropbox-oauth-popup@2.0.1/dist/dropboxPopup.js"></script>
8+
<script src="https://cdn.jsdelivr.net/npm/dropbox-oauth-popup@3.0.0/dist/dropboxPopup.js"></script>
99
</head>
1010

1111
<body>
1212
<div>
1313
<h1>Dropbox OAuth Popup Window</h1>
1414
<p>
15-
See the Dropbox OAuth Popup Window in action by clicking the run example button.
16-
This example will authenticate with your Dropbox account and use the token to fetch
17-
the current account using the `users.getCurrentAccount` endpoint. (Note, nothing is
18-
saved, this is just a demo.)
15+
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,
16+
this is just a demo.)
1917
</p>
20-
<p>See the code on <a
21-
href="https://github.com/rogebrd/dropbox-oauth-popup/blob/main/examples/browser.html">GitHub</a></p>
18+
<p>See the code on <a href="https://github.com/rogebrd/dropbox-oauth-popup/blob/main/examples/browser.html">GitHub</a></p>
2219
<button onclick="runAuth()">Run Example</button>
2320
<p id="result"></p>
2421
<script>
@@ -27,6 +24,7 @@ <h1>Dropbox OAuth Popup Window</h1>
2724
clientSecret: 'tbjemcamktbyiy9',
2825
redirectUri: 'https://rogebrd.github.io/dropbox-oauth-popup/tutorial-browser.html'
2926
});
27+
3028
function runAuth() {
3129
document.getElementById("result").innerHTML = "Waiting for auth...";
3230
popup.authUser().then((auth) => {

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dropbox-oauth-popup",
3-
"version": "2.0.2",
3+
"version": "3.0.0",
44
"registry": "npm",
55
"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.",
66
"homepage": "https://github.com/rogebrd/dropbox-oauth-popup",
@@ -30,7 +30,7 @@
3030
"rollup-plugin-terser": "^7.0.2"
3131
},
3232
"dependencies": {
33-
"dropbox": "^7.0.0"
33+
"dropbox": "^9.8.0"
3434
},
3535
"browserslist": [
3636
"> 0.25%",
@@ -58,4 +58,4 @@
5858
"front-end",
5959
"window"
6060
]
61-
}
61+
}

src/dropboxPopup.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ export default class DropboxPopup {
130130
});
131131
}
132132

133-
const authUrl = popup.authObject.getAuthenticationUrl(popup.redirectUri, popup.state, 'code', popup.tokenAccessType, popup.scope, popup.includeGrantedScopes, popup.usePKCE);
134-
const popupWindow = window.open(authUrl, windowName, popup.windowOptions);
135-
popupWindow.focus();
136-
window.addEventListener('message', handleRedirect, false);
133+
popup.authObject.getAuthenticationUrl(popup.redirectUri, popup.state, 'code', popup.tokenAccessType, popup.scope, popup.includeGrantedScopes, popup.usePKCE)
134+
.then((authUrl) => {
135+
const popupWindow = window.open(authUrl, windowName, popup.windowOptions);
136+
popupWindow.focus();
137+
window.addEventListener('message', handleRedirect, false);
138+
});
137139
});
138140
}
139141
}

0 commit comments

Comments
 (0)