ibm-cloudibm-appid

IBM Cloud App ID: How to setup sign in for users using ibmcloud-appid?


I've been working in a project where I wanted to use IBM Cloud App ID to authenticate users. I'm able to sign-up new users using the ibmcloud-appid node package. There are options to change email, change password, etc etc but I see no method for signing-in.

There are 2 ways to use this package - for securing APIs and for Web Applications. I wanted to use it to secure APIs. For web applications, they have their log-in page and users are able to log-in but for API, I could not find a way to send the user's email and password and authenticate them.

I've referred

https://www.npmjs.com/package/ibmcloud-appid
https://github.com/rotembr/Cloud-Land/blob/master/backend/app.js
https://www.ibm.com/blogs/bluemix/2018/06/custom-login-page-app-id-integration/

Everywhere they've used the IBM App ID's default log-in page. But I have my own login page and node end points. I need to send the email and password from the front-end to my node service and from node service I need to call the API to check if email, password is correct or not. How should I do this with ibmcloud-appid package ?


Solution

  • I would recommend to take a look at this IBM Cloud demo: Cloud Insurace Co. It uses IBM Cloud App ID to authenticate users and has its own login page. The actual code is in the file app.js. It uses the App ID selfServiceManager as well as Passport.

    You would first need to obtain the authentication / JWT token and then later pass it in to the protected API endpoint.