agent icon indicating copy to clipboard operation
agent copied to clipboard

Unable to use /oauth/token since version 2.0.0

Open LieneJansone opened this issue 3 years ago • 0 comments

There is an issue with authentification using Issuer & Validator scheme since version 2.0.0

Issue description: oauth/token endpoint is expecting Content-Type: application/json here, but auth service is expecting Content-Type: application/x-www-form-urlencoded here

To reproduce:

  1. Not passing Context-Type header => returns 415 error code
#!/usr/bin/python3

import json
import requests
import sys

s = requests.Session()
s.headers.update({'X-Optimizely-SDK-Key': "mySDKkey"})

resp = s.post('http://localhost:8080/oauth/token', data={
    "grant_type": "client_credentials",
    "client_id":  "myclientID",
    "client_secret": "myclientSecret",
})

print(resp)
  1. Passing Context-Type: application/json header => returns 400 error code
#!/usr/bin/python3

import json
import requests
import sys

s = requests.Session()
s.headers.update({'X-Optimizely-SDK-Key': "mySDKkey"})
s.headers.update({'Content-Type': 'application/json'})

resp = s.post('http://localhost:8080/oauth/token', data={
    "grant_type": "client_credentials",
    "client_id":  "myclientID",
    "client_secret": "myclientSecret",
})

print(resp)

We are using a custom build image with a workaround of removing contentTypeMiddleware from here

Could this be looked into please? :)

LieneJansone avatar Sep 02 '22 12:09 LieneJansone