capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!
MIT License
223 stars 106 forks source link

Tweaks for using with Spotify OAuth #228

Open FBosito opened 1 year ago

FBosito commented 1 year ago

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:

OAuth Provider:

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

zaosoula commented 2 months ago

+1

zaosoula commented 2 months ago

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

GOinfo-Ltd commented 2 weeks ago

This issue is still present and it prevents using this with Keycloak + code grant.