Support » Plugin: API Bearer Auth » CORS

  • I’m implementation a solution where I need to obtain a bearer token from a different domain (running a solution in a Docker app). Is there a way to enable/support CORS?

    Groet,

    Erik

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author michielve

    (@michielve)

    You mean you have 2 WordPress installations and from installation 1 you want to be able to authenticate to installation 2?

    Thread Starter EvdHeuvel

    (@evdheuvel)

    I’m running WordPress and an automation tool side by side (Node-RED or OL Connect Workflow). The automation tool fetches a bearer key in order to create and update (custom) posts via custom end points. This works like a charm when running everything on the same box. We use this setup in various on-premise solutions.

    I’m currently moving this setup to run on containers to simplify deployment in the cloud. This is where I ran into the CORS challenge.

    Plugin Author michielve

    (@michielve)

    If you can write down what you exactly need from this plugin to make it work for your situation, I can look if this improves the plugin and if I can implement it.

    Thread Starter EvdHeuvel

    (@evdheuvel)

    Alright, let me work on that.

    Thread Starter EvdHeuvel

    (@evdheuvel)

    Hi Michiel,

    I did some debugging and traced things down to the rest_authentication_errors_filter function. The problem in my setup is related to the fact that the host in $currentUrl differs from the $siteUrl. This is caused by the fact that I’m contacting the end points in WordPress from a separate container. This causes the preg_match to return an error resulting in an 401 error in the client in my other container.

    Initally I thought that I could workaround this by setting the Access-Control-Allow-Origin header but I couldn’t get that to work.

    Hope this is of some help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘CORS’ is closed to new replies.