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

Fix web authentication scopes #90

Merged
merged 14 commits into from
Apr 18, 2021
Merged

Conversation

itsMatoosh
Copy link
Collaborator

The web implementation will now use the authentication scopes supplied by the user in methods SpotifySdk.connectToSpotifyRemote and SpotifySdk.getAuthenticationToken. Removed hardcoded scopes. If the supplied scope is null, the implementation will use the minimal list of scopes that are required for the web player to work.

Fixes #87

@itsMatoosh itsMatoosh requested a review from fotiDim April 6, 2021 23:05
lib/spotify_sdk_web.dart Outdated Show resolved Hide resolved
lib/spotify_sdk_web.dart Outdated Show resolved Hide resolved
lib/spotify_sdk_web.dart Outdated Show resolved Hide resolved
lib/spotify_sdk_web.dart Outdated Show resolved Hide resolved
@fotiDim
Copy link
Collaborator

fotiDim commented Apr 8, 2021

Some small things could be improved.
A general suggestion, perhaps for another PR is to use explicit variable types (String, String?, bool etc.) instead of var. spotify_sdk.dart in its majority uses them.

Edit: I just noticed that we have this linting rule that asks for local variables to be declared as var. So the above comment applies only if we have any instance variable leftovers declared as var.

@fotiDim
Copy link
Collaborator

fotiDim commented Apr 10, 2021

Also please state this fix in the changelog under 2.1.0.

@fotiDim
Copy link
Collaborator

fotiDim commented Apr 13, 2021

@itsMatoosh we need to release 2.1.0 soonish as iOS is broken in 2.0.0. If we could finish it up in time would be nice, otherwise it will have to wait for either 2.1.1 or 2.2.

@itsMatoosh
Copy link
Collaborator Author

@fotiDim This should be now all resolved. Sorry for the delay, I was having important uni exams.

lib/spotify_sdk_web.dart Outdated Show resolved Hide resolved
lib/spotify_sdk_web.dart Outdated Show resolved Hide resolved
@@ -163,7 +158,8 @@ class SpotifySdkPlugin {
}

// get initial token
await _authorizeSpotify(clientId: clientId!, redirectUrl: redirectUrl!);
await _authorizeSpotify(
clientId: clientId!, redirectUrl: redirectUrl!, scopes: scopes);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clientId: clientId!, redirectUrl: redirectUrl!, scopes: scopes);
clientId: clientId, redirectUrl: redirectUrl, scopes: scopes);

Comment on lines 152 to 153
if (!(clientId?.isNotEmpty == true &&
redirectUrl?.isNotEmpty == true)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better change that one as the one below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, that is indeed much better, I made the changes now.

Copy link
Collaborator

@fotiDim fotiDim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the changes. Looks good! 😎

@fotiDim fotiDim merged commit 045fee7 into main Apr 18, 2021
@itsMatoosh itsMatoosh deleted the bugfix/web-authentication-scopes branch April 18, 2021 22:32
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

Successfully merging this pull request may close these issues.

Authentication scopes for web are hardcoded
2 participants