okta / samples-nodejs-express-4

Express 4 samples. Will publish an artifact that can be consumed by end-to-end sample repos
Other
119 stars 119 forks source link

Failed to run `nom start` on mac os #29

Closed zhaoyi0113 closed 6 years ago

zhaoyi0113 commented 6 years ago

I cloned this repo and run nom install. After that, I modify the .samples.config.json to be my app on okta. But I got below errors when run nom start.

> node lib/index.js

Unable to configure ExpressOIDC { HTTPError: Response code 401 (Unauthorized)
    at stream.catch.then.data (/Users/joey/dev/bigcrunch/samples-nodejs-express-4/node_modules/got/index.js:182:13)
    at process._tickCallback (internal/process/next_tick.js:109:7)
  name: 'HTTPError',
  host: 'ev-883158-admin.oktapreview.com',
  hostname: 'ev-883158-admin.oktapreview.com',
  method: 'GET',
  path: '/oauth2/default/.well-known/openid-configuration',
  protocol: 'https:',
  url: 'https://ev-883158-admin.oktapreview.com/oauth2/default/.well-known/openid-configuration',
  statusCode: 401,
  statusMessage: 'Unauthorized',
  headers:
   { date: 'Wed, 15 Nov 2017 10:50:05 GMT',
     server: 'nginx',
     'public-key-pins-report-only': 'pin-sha256="jZomPEBSDXoipA9un78hKRIeN/+U4ZteRaiX8YpWfqc="; pin-sha256="axSbM6RQ+19oXxudaOTdwXJbSr6f7AahxbDHFy3p8s8="; pin-sha256="SE4qe2vdD9tAegPwO79rMnZyhHvqj3i5g1c2HkyGUNE="; pin-sha256="ylP0lMLMvBaiHn0ihLxHjzvlPVQNoyQ+rMiaj0da/Pw="; max-age=60; report-uri="https://okta.report-uri.io/r/default/hpkp/reportOnly"',
     'content-type': 'application/json',
     'x-okta-request-id': 'Wgwb3bZQfnLAHp9WzIM-1AAABpg',
     p3p: 'CP="HONK"',
     'x-rate-limit-limit': '10000',
     'x-rate-limit-remaining': '9998',
     'x-rate-limit-reset': '1510743012',
     'cache-control': 'no-cache, no-store',
     pragma: 'no-cache',
     expires: '0',
     'set-cookie':
      [ 'sid=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/',
        'JSESSIONID=665A7C6EA378A07968363748159589E1; Path=/' ],
     connection: 'close',
     'transfer-encoding': 'chunked' } }
robertjd commented 6 years ago

Hi @zhaoyi0113 , thanks for getting in touch! It looks like you're missing the "d" to make "dev-" in your issuer URL. If I add that I can see the well-known response:

https://dev-883158-admin.oktapreview.com/oauth2/default/.well-known/openid-configuration

Hope this helps!

zhaoyi0113 commented 6 years ago

Great catch. I feel stupid about this error. Thanks for your help.