Let's build out a LinkedIn authentication integration on Red Hat OpenShift! We're going to follow the steps outlined in this blog post, but updating them to work on Red Hat OpenShift and Kubernetes.
- Sign Up for IBM Cloud: https://ibm.biz/os-linkedin-auth
- Log In to LinkedIn: https://www.linkedin.com
- Ensure you're logged in to IBM Cloud: https://ibm.biz/os-linkedin-auth
- Create an App ID Service. Make sure you select the Lite tier before clicking Create.
- In the left-hand menu, click Applications, then Add Application. Choose an application name and select Web Application, then click Save.
- Click the tick mark next to your application to expand the application details. Here you'll find credentials to plug into your sample app.
- In the left-hand menu, under Identity Providers, click Custom Identity.
- Here is where you'll paste in the public key that we create in a later step. Keep this tab open.
- In order to create an app through the LinkedIn Developer portal, you'll first need to Create a Page on LinkedIn
- Create an App on LinkedIn
- In the Auth tab, copy down your Client ID and Client Secret
- In the Products tab, click the Select button next to Sign In with LinkedIn.
- Fill out the form at https://openidauth2.mybluemix.net with the email address for your IBM Cloud account and oslab as the lab key.
- Go to your IBM Cloud Notifications and find the message You are invited to join an account in IBM Cloud. Click Join now.
- On the next page, click Accept Invite.
- Go back to your IBM Cloud Dashboard. On the top menu bar, to the right, click on your account name (just to the right of "Manage") and select 1840867 - Advowork from the drop-down menu.
- Click here to get a list of the clusters in your account. You should see one named something like openidauth2-000. Click it.
- In the upper-right, click Actions then select Connect via CLI. Follow the instructions on this page to get your login command.
- In the upper-right, click IBM Cloud Shell, just to the right of your account name.
- When the shell loads, paste the login command into the shell.
- You're now logged in to your Red Hat OpenShift cluster. Let's create a new command by executing
oc new-project webapp
- Now, let's generate some new public and private keys:
openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048
openssl rsa -pubout -in private_key.pem -out public_key.pem
- Execute
cat public_key.pem
and paste the results into the App ID browser tab we kept open from the prior steps. Click Save. - Execute
git clone https://github.com/drnugent/appid-rhos
, thencd appid-rhos
- Open
app.js
and replace the JSON with your App ID application details from the browser tab you kept open in a prior step.
const config = {
"clientId": "clientId",
"oauthServerUrl": "oauthServerUrl",
"profilesUrl": "profilesUrl",
"secret": "secret",
"tenantId": "tenantId",
"preferredLocale": "en"
};
- Additionally, replace the LinkedIn credentials with the values from the LinkedIn tab you kept open in a prior step.
const LINKEDINCLIENTID = "LINKEDINCLIENTID";
const LINKEDINSECRET = "LINKEDINSECRET";
- Link to Crowdcast: https://www.crowdcast.io/e/os-linkedin-auth?utm_source=profile&utm_medium=profile_web&utm_campaign=profile
- Will the workshop be recorded? Yes, the workshop will be recorded and availalbe at the same URL on Crowdcast. It will take a few minutes to process at the end of the event, after which you'll be able to see it.
- Can I ask questions after the workshop? Yes, Dave will be available on Twitter: https://twitter.com/drnugent