0
votes

I did the http://learnforge.autodesk.io tutorial and locally the apps work fine. But when I try to deploy the forge.tutorial.viewhubmodels.nodejs app to Heroku I get the following error when I try to log in:

GET https://forgebcsample.herokuapp.com/api/forge/oauth/token 401 (Unauthorized)

The Config Vars are correct in the Heroku dashboard and I updated the values at the Forge Developer Portal as it is described in the tutorial under deployment. I even tried hardcoding the FORGE_CLIENT_ID, FORGE_CLIENT_SECRET and FORGE_CALLBACK_URL into the app but the error still persists.

Heroku Log:

  • 2018-09-07T06:59:41.950470+00:00 heroku[router]: at=info method=GET path="/" host=forgebcsample.herokuapp.com request_id=6ef8e0d2-d814-478a-bbe2-e624789aceee fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=304 bytes=237 protocol=https
  • 2018-09-07T06:59:42.215849+00:00 heroku[router]: at=info method=GET path="/js/ForgeTree.js" host=forgebcsample.herokuapp.com request_id=6d58c9c0-afce-4c44-b1e0-f9d40326c607 fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=304 bytes=238 protocol=https
  • 2018-09-07T06:59:42.214891+00:00 heroku[router]: at=info method=GET path="/css/main.css" host=forgebcsample.herokuapp.com request_id=66be297d-0707-4e5d-8c6a-c4fb269c11f0 fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=304 bytes=237 protocol=https
  • 2018-09-07T06:59:42.453624+00:00 heroku[router]: at=info method=GET path="/js/ForgeViewer.js" host=forgebcsample.herokuapp.com request_id=bc8f0050-1ca2-46b9-84be-d1e36c8afcf4 fwd="202.148.226.254" dyno=web.1 connect=1ms service=4ms status=304 bytes=237 protocol=https
  • 2018-09-07T06:59:43.486820+00:00 heroku[router]: at=info method=GET path="/api/forge/oauth/token" host=forgebcsample.herokuapp.com request_id=d6acdca3-1424-48b9-9480-d0497af58179 fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=401 bytes=127 protocol=https
  • 2018-09-07T07:00:51.391643+00:00 heroku[router]: at=info method=GET path="/api/forge/oauth/url" host=forgebcsample.herokuapp.com request_id=ab185f67-7288-43ce-bdf7-9551b8771bba fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=200 bytes=382 protocol=https
  • 2018-09-07T07:00:58.551942+00:00 heroku[router]: at=info method=GET path="/api/forge/callback/oauth?code=46TAvefGUSv_xZ6cTJKzyx-t-HT6Y2FzvDyzZQIS" host=forgebcsample.herokuapp.com request_id=b67abc9f-419e-47d3-892a-3fcc6fbf7f7d fwd="202.148.226.254" dyno=web.1 connect=1ms service=227ms status=302 bytes=234 protocol=https
  • 2018-09-07T07:00:58.808686+00:00 heroku[router]: at=info method=GET path="/" host=forgebcsample.herokuapp.com request_id=1a2ff1de-513e-40e2-a73a-0b48781a06bc fwd="202.148.226.254" dyno=web.1 connect=1ms service=17ms status=304 bytes=237 protocol=https
  • 2018-09-07T07:00:59.082869+00:00 heroku[router]: at=info method=GET path="/css/main.css" host=forgebcsample.herokuapp.com request_id=428a5759-895f-45e5-a9db-48d8721889c0 fwd="202.148.226.254" dyno=web.1 connect=1ms service=5ms status=304 bytes=237 protocol=https
  • 2018-09-07T07:00:59.325093+00:00 heroku[router]: at=info method=GET path="/js/ForgeTree.js" host=forgebcsample.herokuapp.com request_id=04a300dc-8697-4097-8c06-1788e21db69d fwd="202.148.226.254" dyno=web.1 connect=1ms service=3ms status=304 bytes=238 protocol=https
  • 2018-09-07T07:00:59.822084+00:00 heroku[router]: at=info method=GET path="/js/ForgeViewer.js" host=forgebcsample.herokuapp.com request_id=c601f61e-cfea-4738-8837-540941adaf96 fwd="202.148.226.254" dyno=web.1 connect=1ms service=11ms status=304 bytes=237 protocol=https
  • 2018-09-07T07:01:00.157419+00:00 heroku[router]: at=info method=GET path="/api/forge/oauth/token" host=forgebcsample.herokuapp.com request_id=77b86dc0-50c7-429e-ade9-82e1b8fa56db fwd="202.148.226.254" dyno=web.1 connect=1ms service=2ms status=401 bytes=127 protocol=https
1

1 Answers

0
votes

The 401 is expected until you sign in, then it should return 200

I tried run your herokuapp, but could not sign in as the callback url is not properly set. Please make sure it uses the exact same value as on your Forge app.

EDIT

Can try comment the following line on start.js

secure: (process.env.NODE_ENV === 'production'),