Festify / cordova-spotify-oauth

🔐 Easy Spotify authentication for Cordova / PhoneGap apps
MIT License
16 stars 18 forks source link

Failed to load with capacitor #36

Open rfrancesca12 opened 3 years ago

rfrancesca12 commented 3 years ago

Has anyone tried and installed it with Ionic Capacitor? I'm trying to open it on ios, but it gives me this error no such file or directory, stat '/Users/user/ionic/suggestion/node_modules/cordova-spotify-oauth/src/ios/spotify-sdk/SpotifyAuthentication.framework'

Any suggestions? Thanks!

tobika commented 3 years ago

I did but only for android.Did you add the SpotifyAuthentication.framework by hand in xcode? I guess you can download it directly at spotify

ConnorsApps commented 3 years ago

A rough work around I've found is to use a in app browser instead of this framework for capacitor. Use the old "InAppBrowser".

    const authUrl = `https://accounts.spotify.com/authorize?response_type=code&client_id=${SPOTIFY_CLIENT_ID}${
        USER_SCOPES ? '&scope=' + encodeURIComponent(USER_SCOPES) : ''
      }&redirect_uri=${encodeURIComponent(SET_TOKEN_URL)}`;

      const browser = this.iab.create(authUrl, '_blank'); // _system has issues
      browser.show();
      browser.on('loadstart').subscribe((loadstart) => {
        const code = this.getUserAndCodeFromHref(loadstart.url);
        if (code) {
          console.log('code', code);
          this.setUserAuthCode(code);
          browser.close();
        } else if (loadstart.url.includes('?error=access_denied')) {
          browser.close();
          throw new Error('Access Denied');
        }
      });
jcesarmobile commented 2 years ago

They fixed this issue, but they have not released the fix in npm

try installing the plugin like this npm install github:Festify/cordova-spotify-oauth or npm install https://github.com/Festify/cordova-spotify-oauth