()
| 137 | } |
| 138 | |
| 139 | updateToken() { |
| 140 | if (context.gapiRefreshToken) { |
| 141 | return new Promise((resolve, reject) => { |
| 142 | const payload = { |
| 143 | refresh_token: context.gapiRefreshToken, |
| 144 | client_id: "971735641612-am059p55sofdp30p2t4djecn72l6kmpf.apps.googleusercontent.com", |
| 145 | client_secret: __SECRET__, |
| 146 | redirect_uri: "urn:ietf:wg:oauth:2.0:oob", |
| 147 | grant_type: "refresh_token", |
| 148 | } |
| 149 | $.ajax({ |
| 150 | url: "https://www.googleapis.com/oauth2/v4/token", |
| 151 | method: 'POST', |
| 152 | dataType: 'json', |
| 153 | contentType: 'application/json', |
| 154 | data: JSON.stringify(payload) |
| 155 | }) |
| 156 | .done(response => { |
| 157 | context.gapiToken = response.access_token; |
| 158 | chrome.storage.sync.set({ |
| 159 | gapiToken: response.access_token |
| 160 | }, () => { |
| 161 | resolve(); |
| 162 | }); |
| 163 | }); |
| 164 | }) |
| 165 | } else { |
| 166 | return new Promise((resolve, reject) => { |
| 167 | chrome.runtime.sendMessage({ |
| 168 | cmd: 'login', |
| 169 | interactive: false |
| 170 | }, token => { |
| 171 | context.gapiToken = token; |
| 172 | resolve(); |
| 173 | }) |
| 174 | }); |
| 175 | } |
| 176 | } |
| 177 | } |
no outgoing calls
no test coverage detected