capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tweaks for using with Spotify OAuth

FBosito opened this issue · comments

Description

Capacitor version:

Run npx cap doctor:

Latest Dependencies:

@capacitor/cli: 4.6.2
@capacitor/core: 4.6.2
@capacitor/android: 4.6.2
@capacitor/ios: 4.6.2

Installed Dependencies:

@capacitor/cli: 4.6.2
@capacitor/core: 4.6.2
@capacitor/android: 4.6.2
@capacitor/ios: 4.6.2

Library version:

  • 3.0.1

OAuth Provider:

  • Other: Spotify

Information

Thank you for your great work.

I tried using your tool to authenticate with Spotify.
But that wasn't possible out of the box, so I had to make the following adjustments:

cache-control header

If the cache-control header is sent with the token queries, the server returns a CORS error.
Solution => a disableCacheControlHeader flag in OAuth2AuthenticateBaseOptions

Authorization required for token queries

Spotify would like to have an authorization for the queries for the access_token and refresh_token in the header (https://developer.spotify.com/documentation/general/guides/authorization/code-flow/)

Authorization: Basic base64encodedKey
The key consists of Spotify Client ID and Client Secret

solution =>
Quick and dirty: also send the additionalResourceHeaders with the token queries
clean: own property for additionalTokenRequestHeaders

The issue is still there one year later, can someone give it a look