Setting up Node OAuth applications with WSO2 Identity Server.

Wathsara Wishwantha Daluwatta
4 min readNov 25, 2019

Hello… Today I’m going to do some interesting things. I’m going to show you guys how to config a node application with the WSO2 Identity Server. No need to talk a lot lets move to the configurations.

Prerequisites

  1. Download the product.
  • In your Web browser, go to http://wso2.com/products/identity-server.
  • Click the Download button in the upper right-hand corner of the page to download the latest version. To download an older version, click the Previous Releases link and then select the version that you want.
  • Enter the required details in the form, and click Download.

2. Clone the samples repository from https://github.com/Wathsara/OAuth-Node-WSO2-IS.

To start the server click here and follow the steps correctly.

Configurations.

Open the management console https://localhost:9443/carbon and login with admin user credentials. (username — admin, password — admin).

Login page of Management console
Menu

After you successfully login to the Management Console, you can find out the menu bar on the right-hand side of the window.

Click the add button under service providers.

Then you will be redirected to the add new service provider page.

Add New Service Provider Page

Enter an unique name for service provider.

I added oAuth as my service provider name.

Description field is optional and just ignore it for now and click the Register button.

Then You will redirect to the configure service provider page, where you can find many options to configure your service provider.

configure service provider page

For now, go to the
Inbound Authentication Configuration → OAuth/OpenID Connect Configuration → Configure.

Then You will redirect to the Register new application settings page.

Register New Application page

Put the call-back URL of the application.

You can add your own redirect URL as well. But for now, add the URL given below which will ease the inauguration of the node application.

http://localhost:8010/oauth

Then click the Add button.

After that You’ll redirect back and you’ll be able to find out you client key and client Secret.

Client key and client secret

Now you successfully configured your service provider inside the WSO2 identity server.

Config the Node application

Open the cloned project and run npm i command.

index.js

Then open the index.js file and replace the clientID with your client key and and clientSecret with your client secret.

index.html

Open the public → index.html file and replace the client_id with your client key.

Configurations are all done. Run node index,js command.

Then go to http://localhost:8010/.

Opening page.

Then Click the Login with wso2 Identity Server link. Then you will redirect to the login page of the wso2 is.

Login page

Then enter the admin credentials (username — admin, password — admin).

Then click Approve once and press continue.

Authorize page

Then you will redirect to the welcome.html page and you will get the access token as well.

welcome.html

That’s It. You have your own OAuth application with WSO2 Identity server.

If you gained something from this article let me know with a comment or claps.And I’m looking forward to see you again soon with my next article. Have a Good Day!!

--

--

Wathsara Wishwantha Daluwatta

Software Engineer at WSO2 | Studied BSc (Hons) Software Engineering at University of Colombo School of Computing