Selaa lähdekoodia

Encode state to base64 to pass to oauth

Harry Hedger 9 vuotta sitten
vanhempi
commit
cf03fb784d
1 muutettua tiedostoa jossa 6 lisäystä ja 2 poistoa
  1. 6 2
      src/plugins/GoogleDrive.js

+ 6 - 2
src/plugins/GoogleDrive.js

@@ -210,11 +210,15 @@ export default class Google extends Plugin {
    * Render user authentication view
    * Render user authentication view
    */
    */
   renderAuth () {
   renderAuth () {
-    const link = `${this.opts.host}/connect/google?state=${location.href}`
+    const state = btoa(JSON.stringify({
+      redirect: location.href
+    }))
+
+    const link = `${this.opts.host}/connect/google?state=${state}`
     return yo`
     return yo`
       <div class="UppyGoogleDrive-authenticate">
       <div class="UppyGoogleDrive-authenticate">
         <h1>You need to authenticate with Google before selecting files.</h1>
         <h1>You need to authenticate with Google before selecting files.</h1>
-        <a href=${link}>Authenticate</a>
+        <a href=${link} target="_blank">Authenticate</a>
       </div>
       </div>
     `
     `
   }
   }