Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'auth_failed' error while trying to receive access token #24

Closed
Kruszylo opened this issue Jul 3, 2019 · 1 comment
Closed

'auth_failed' error while trying to receive access token #24

Kruszylo opened this issue Jul 3, 2019 · 1 comment

Comments

@Kruszylo
Copy link

Kruszylo commented Jul 3, 2019

Hi, I have been using your plugin in my project without problems until today, when I decided to test authorization after a long time of developing. I was surprised when instead of token I received error 'auth_failed'. After a few hours of evestigating, I decided to reject all possible mistakes and separated authorization into an individual project. And still, when I run the process I see how authorization view pop-ups, then after some time of loading it's hiding down and returns the error. Steps to reproduce the error (on base of this tutorial):

ionic start testspotifyauth blank
cd testspotifyauth
ionic cordova plugin add cordova-spotify-oauth
ionic cordova plugin add cordova-plugin-customurlscheme --variable URL_SCHEME= testspotifyauth

home.page.ts:

import { Component } from '@angular/core';
import { NavController } from '@ionic/angular';
 
declare var cordova: any;
@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {
  result = {};
 
  constructor(public navCtrl: NavController) { }
 
  authWithSpotify() {
    const config = {
      clientId: "my spotify id",
      redirectUrl: "whatever://callback",
      scopes: ["streaming", "playlist-read-private", "user-read-email", "user-read-private"],
      tokenExchangeUrl: "https://tmdj-oauth-server.herokuapp.com/exchange",
      tokenRefreshUrl: "https://tmdj-oauth-server.herokuapp.com/refresh",
    };
 
    cordova.plugins.spotifyAuth.authorize(config)
      .then(({ accessToken, encryptedRefreshToken, expiresAt }) => {
        this.result = { access_token: accessToken, expires_in: expiresAt, ref: encryptedRefreshToken };
        console.log(this.result);
      });
  }
}

home.page.html:

<ion-header>
  <ion-toolbar>
    <ion-title>
      Ionic Blank
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <div class="ion-padding">
    The world is your oyster.
    <ion-button (click)="authWithSpotify()">Auth</ion-button>
  </div>
</ion-content>

I'm not sure where this error comes from, but mb it appeared after I updated my android device.
Model: SM-N960F
Android version: 9

@NeoLegends
Copy link
Member

Hey, can you see any errors in the device console?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants