question

johnhuffsmith avatar image
johnhuffsmith asked hammer commented

CORS issue with remote-pay-cloud demo app

I'm working my way through the cloudindex.html example (https://github.com/clover/remote-pay-...index.html). I successfully authenticate after entering the Client ID/App ID; however, on the subsequent page I'm getting a CORS error with the request to /devices. When I re-request the devices URL manually I can see the json output with my Clover mini info.

In the Web app configuration on the sandbox site, I have my Site URL set to https://localhost:8443 and my CORS Domain set to https://localhost:8443

Here is the specific error from Chrome's console: "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://localhost:8443' is therefore not allowed access. The response had HTTP status code 401."

When I make the same request but with type OPTIONS (using curl), I get the following headers returned:

< HTTP/1.1 200 OK
< Allow: GET, OPTIONS
< Access-Control-Allow-Origin: https://localhost:8443
< Access-Control-Allow-Methods: GET, OPTIONS
< Access-Control-Allow-Headers: Content-Type, Accept, Authorization
< Content-Length: 0
< X-Frame-Options: SAMEORIGIN

The GET response for reference:

< HTTP/1.1 401 Unauthorized
< Content-Length: 30
< Content-Type: application/json; charset=utf-8
< X-Frame-Options: SAMEORIGIN
6 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bryanne Vega avatar image Bryanne Vega commented ·

I'm too getting this problem, any luck?

0 Likes 0 ·
johnhuffsmith avatar image johnhuffsmith commented ·

I was able to get around this issue by disabling CORS protection in chrome, but then ran into another error when trying to pair my clover mini (401 unauthorized). Would like to hear from someone at clover if this demo app is supposed to work or if these are known issues...

0 Likes 0 ·
hammer avatar image hammer ♦ commented ·

Hi John, let me try to help. Please be aware, this is a very early version of this capability, and some pieces are not yet fully available. 1. What is the full url that you are hitting in chrome? (Preferably the one that is displayed AFTER you have successfully performed oauth) 2. In the initial url (EX: https://localhost:8443/cloud_index.html) What are the values used for Client ID and Clover Server URL? This is for add id - VFRRV03N7R32M - correct?

0 Likes 0 ·
johnhuffsmith avatar image johnhuffsmith commented ·

Hi hammer, sorry I haven't responded, I'm not getting notified of new comments. I tried out the demo app again today with the latest code and now am running into the same problem described in "saurav's" Nov 5th comment here: http://devask.clover.com/question/422...

0 Likes 0 ·
johnhuffsmith avatar image johnhuffsmith commented ·

hammer, in response to your question about pairing the clover mini, here is the url the demo app is POSTing to:

https://sandbox.dev.clover.com/v2/mer...pay?accesstoken=[removed]

with the payload:

{"deviceId":"[removed]","isSilent":true}

This returns a 401, and the access_token gets revoked

0 Likes 0 ·
Show more comments

0 Answers

Welcome to the
Clover Developer Community