ga-wdi-boston / full-stack-project

Other
8 stars 64 forks source link

No 'Access-Control-Allow-Origin' header #1014

Closed ghost closed 7 years ago

ghost commented 7 years ago

I get the following message when trying to sign up or add content to my list of items.

XMLHttpRequest cannot load https://hidden-spire-77972.herokuapp.com/sign-up. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://parthgpatel.github.io' is therefore not allowed access. The response had HTTP status code 400.

tvcrawley commented 7 years ago

Do you have the CLIENT_ORIGIN set in your Heroku app?

ghost commented 7 years ago

yes I set it up earlier with Michael

tvcrawley commented 7 years ago

Can you post the code for the config.js in the client?

ghost commented 7 years ago
screen shot 2017-07-24 at 2 38 28 pm
kailinc commented 7 years ago

www.parthgpatel.github.com.io does not exist when I went into the link. When I go to www.kailinc.github.io it works. I think the problem is there

tvcrawley commented 7 years ago

What's the output of heroku config?

ghost commented 7 years ago
CLIENT_ORIGIN:            https://parthgpatel.github.io
DATABASE_URL:             postgres://yszfczfoixflyc:30732a8ca8d25d8d004cca3cc0f634fbeb0485e71541f66d8023b7ae79a1efc5@ec2-50-17-217-166.compute-1.amazonaws.com:5432/d481nvprjd9pi4
LANG:                     en_US.UTF-8
RACK_ENV:                 production
RAILS_ENV:                production
RAILS_LOG_TO_STDOUT:      enabled
RAILS_SERVE_STATIC_FILES: enabled
SECRET_KEY_BASE:          
SECRET_TOKEN:  
kailinc commented 7 years ago

The secret key bas and secret token exists, but it is not showing

tvcrawley commented 7 years ago

Was this step in the rails-api-template followed:

In order to make requests to your deployed API, you will need to set SECRET_KEY_BASE in the environment of the production API (using heroku config:set or the Heroku dashboard).

This is in addition to creating secret keys locally.

ghost commented 7 years ago

yes

ghost commented 7 years ago

heroku config:set SECRET_KEY_BASE=$(rake secret) Setting SECRET_KEY_BASE and restarting ⬢ mealtrackingapp... done, v20 ~/desktop/Meal-Tracker-API-master (master)

heroku config:set SECRET_TOKEN=$(rake secret) Setting SECRET_TOKEN and restarting ⬢ mealtrackingapp... done, v20

benjimelito commented 7 years ago

Please close this out when you get a chance!

ghost commented 7 years ago

solved

Fcarrion001 commented 7 years ago

solution?