| 137 | openAuthPage(url, config.redirect_uri); |
| 138 | }, |
| 139 | async authorized(params) { |
| 140 | const data = await this.loadData({ |
| 141 | method: 'POST', |
| 142 | url: 'https://api.dropbox.com/oauth2/token', |
| 143 | headers: { |
| 144 | 'Content-Type': FORM_URLENCODED, |
| 145 | }, |
| 146 | body: dumpQuery({ |
| 147 | client_id: config.client_id, |
| 148 | ...params, |
| 149 | }), |
| 150 | responseType: 'json', |
| 151 | }); |
| 152 | if (!data.access_token) throw data; |
| 153 | this.config.set({ |
| 154 | token: data.access_token, |
| 155 | refresh_token: data.refresh_token || params.refresh_token, |
| 156 | }); |
| 157 | }, |
| 158 | matchAuth(url) { |
| 159 | const redirectUri = `${config.redirect_uri}?`; |
| 160 | if (!url.startsWith(redirectUri)) return; |