@@ -219,7 +219,8 @@ async function getTotp(text: string) {
219219}
220220
221221function getBackupToken ( service : string ) {
222- if ( navigator . userAgent . indexOf ( "Chrome" ) !== - 1 && service === "drive" ) {
222+ if ( navigator . userAgent . indexOf ( "Chrome" ) !== - 1 &&
223+ navigator . userAgent . indexOf ( "Edg" ) === - 1 && service === "drive" ) {
223224 chrome . identity . getAuthToken (
224225 {
225226 interactive : true ,
@@ -233,18 +234,24 @@ function getBackupToken(service: string) {
233234 ) ;
234235 } else {
235236 let authUrl = "" ;
237+ let redirUrl = "" ;
236238 if ( service === "dropbox" ) {
239+ redirUrl = encodeURIComponent ( chrome . identity . getRedirectURL ( ) ) ;
237240 authUrl =
238241 "https://www.dropbox.com/oauth2/authorize?response_type=token&client_id=" +
239242 getCredentials ( ) . dropbox . client_id +
240- "&redirect_uri=" +
241- encodeURIComponent ( chrome . identity . getRedirectURL ( ) ) ;
243+ "&redirect_uri=" + redirUrl
242244 } else if ( service === "drive" ) {
245+ if ( navigator . userAgent . indexOf ( "Edg" ) !== - 1 ) {
246+ redirUrl = encodeURIComponent ( "https://authenticator.cc/oauth-edge" ) ;
247+ } else {
248+ redirUrl = encodeURIComponent ( "https://authenticator.cc/oauth" ) ;
249+ }
250+
243251 authUrl =
244252 "https://accounts.google.com/o/oauth2/v2/auth?response_type=code&access_type=offline&client_id=" +
245253 getCredentials ( ) . drive . client_id +
246- "&scope=https%3A//www.googleapis.com/auth/drive.file&prompt=consent&redirect_uri=" +
247- encodeURIComponent ( "https://authenticator.cc/oauth" ) ;
254+ "&scope=https%3A//www.googleapis.com/auth/drive.file&prompt=consent&redirect_uri=" + redirUrl
248255 }
249256 chrome . identity . launchWebAuthFlow (
250257 { url : authUrl , interactive : true } ,
0 commit comments