Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stepoibm opened this issue May 21, 2022 · 2 comments
Assignees

Comments

@stepoibm
Copy link

stepoibm commented May 21, 2022

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

@stepoibm
Copy link
Author

stepoibm commented May 24, 2022

@VadimDez discovered, that the issue does not exist for passport version 0.5.3. Current version is 0.6.0

@jay-mack
Copy link
Contributor

jay-mack commented Feb 9, 2023

@stepoibm A new version of the SDK has been released, v7, this includes revised samples of AppID working with passport v6. You mostly likely will need to make changes to your application so play around with the examples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants