feat(selfservice/strategy/oidc): add spotify provider #1985
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a self-service OIDC provider for Spotify's accounts API and supporting documentation.
While Spotify makes it appear that they support OIDC and they provide a discovery URL, they do not actually support OpenID Connect. Any attempt to use an OIDC client with Spotify will result in errors from Spotify about the
openid
scope, which makes it incompatible with Kratos' "generic" provider as it understandably injects theopenid
scope into the list of scopes you configure it with.This pull request adds a new provider to the OIDC strategy that creates a suitable oauth2 configuration for Spotify's nuances and then uses the Spotify API to retrieve the user's profile and account information.
Related issue(s)
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments
Originally I thought it would be possible to use the
generic
OIDC provider to interface with Spotify, but I quickly realized that their OpenID Connect implementation was not an actual implementation that was up to spec, and at best was very basic OAuth2.Due to not being an actual OpenID Connect provider, the Spotify accounts API did not work directly with OIDC's
generic
provider because of the requiredopenid
scope not being supported by Spotify (despite Spotify indicating otherwise) and lacking claims in the response data due to an additional API call being required to retrieve the account information from Spotify.