Skip to content

Cannot access /protected in provided WebAppSample "Protecting web applications using WebAppStrategy" #269

Description

@stepoibm

Hi! I'm having trouble getting the example to work. The returned token from the appID login don't seem to persist in the session or in a cookie, so I can't ever access the "protected" endpoint. Am I missing something?

Reproduction steps

  1. install required packages npm install --save ibmcloud-appid log4js passport express-session express pug
  2. get sample folder from this repo
  3. save provided example as server.js
  4. replace this in server.js with data from existing appid instance
passport.use(new WebAppStrategy({
	tenantId: "{tenant-id}",
	clientId: "{client-id}",
	secret: "{secret}",
	oauthServerUrl: "{oauth-server-url}",
	redirectUri: "{app-url}" + CALLBACK_URL
}));
  1. register callback uri with appid (for me http://localhost:3000/ibm/bluemix/appid/callback)
  2. run node server.js
  3. navigate to http://localhost:3000/web-app-sample.html
  4. click "open protected page"
  5. login
  6. navigate to http://localhost:3000/web-app-sample.html
  7. click "open protected page"

Expected

  1. http://localhost:3000/web-app-sample.html should not show "You're not authenticated :(" after logging in in step 10
  2. after login I should be able to access /protected

Additional

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions