Adding an Accept: application/json header in Access token request is required for authentication flow to work correctly.
Add this missing header in code in OauthService.OAuthService.fetchAndProcessToken(params: HttpParams): Promise<TokenResponse> method (line : 1718)
var headers = new HttpHeaders()
.set('Content-Type', 'application/x-www-form-urlencoded')
.set('Accept', "application/json"); // Those are the missing headers ...
Other suggestion : Add it also for other requests to avoid any other similar issues?
Authentication flow shall work with Github Oauth2 APIs.
Access tokens requests shall be sent with a "Accept: application/json" header
Desktop (please complete the following information):
OS: Windows 10
Browser : Chrome
Version : 9.2.0
Additional context
Other note : Using an Accept: application/json header in requests is working and also accepted by other popular Oauth/OIDC providers : Azure, Google, Facebook, Keycloak (tested with a patch of current library code).
Authentication flow is failing with Github Oauth2 APIs. This is because Github Oauth2 API does not send Access Token in JSON format by default, whereas the library expects a JSON format return. See : https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/?#response
Suggesion of correction
Adding an
Accept: application/json
header in Access token request is required for authentication flow to work correctly.Add this missing header in code in
OauthService.OAuthService.fetchAndProcessToken(params: HttpParams): Promise<TokenResponse>
method (line : 1718)Other suggestion : Add it also for other requests to avoid any other similar issues?
To Reproduce
Oauth Config used:
Expected behavior
Authentication flow shall work with Github Oauth2 APIs. Access tokens requests shall be sent with a "Accept: application/json" header
Desktop (please complete the following information):
Additional context
Other note : Using an
Accept: application/json
header in requests is working and also accepted by other popular Oauth/OIDC providers : Azure, Google, Facebook, Keycloak (tested with a patch of current library code).