Authentication - Authorization Code (Node.js Example)
Welcome to our Quickstart guide for using the Admin API with OpenID Connect and OAuth 2.0 for authentication, utilizing Node.js in our example project.
In this quickstart, we will walk you through the process of making your first OpenID Connect authentication using our example project, Admin API OpenID Connect Example, which is written in Node.js.
OpenID Connect and OAuth 2.0 are industry-standard protocols for authenticating users and protecting access to APIs. By using these protocols, the Admin API ensures that only authorized users can access the resources they are requesting.
The example project we will be using in this quickstart is designed to help you get started quickly and easily with the use of Node.js. It provides a simple and straightforward way to test the authentication process and familiarize yourself with the Admin API.
We will take you step by step through the process of setting up the example project and making your first OpenID Connect authentication request. Along the way, we will provide tips and best practices to help you understand the process and ensure that everything is set up correctly.
By the end of this quickstart, you will have a solid understanding of how to use the Admin API with OpenID Connect and OAuth 2.0 for authentication, utilizing Node.js in your project. But as a reminder, Node.js is not the only way to use our API; any language with a method to send standard HTTP requests will do.
So, let’s get started!
Prerequisites
Before you get started, you’ll need to have access to the Banno Back Office.
You’ll need to get the following from the back office administrator at your financial institution.
- API Credentials
- User Account
If you are a financial institution or working directly with a financial institution, you should work with the back office administrator at your institution to get appropriate access to the Admin API.
If you are a fintech or other developer working without a financial institution, you are likely using the JackHenry.Dev developer portal. In this case, you will not have access to the Banno Back Office.
API credentials
You’ll need API credentials to exercise the authorization flow. The Banno Back Office administrator at your financial institution can provide you with a client_id
and client_secret
that you can use to access the Admin API in your environment.
For this example to run correctly, you will need to set https://localhost:8080/auth/cb
as the redirect URI.
User account
You will need a user account to complete the authorization flow.
Software requirements
Node.js, npm, nvm
The example is built for Node.js and npm.
If you don’t have these installed on your system already, you may want to install a Node Version Manager such as nvm.
Admin API OpenID Connect example
- Clone the Admin API OpenID Connect Example repository.
- Install project dependencies
Running the example (Locally)
Complete the steps from the prerequisites section and navigate to the root folder admin-api-openid-connect-example/.
Specifically, you’ll need to edit the config.js
file to add your own client_id
and client_secret
.
The server will now be running locally. You’ll see this log statement in the terminal:
- Go to https://localhost:8080/ in a web browser.
- Click on Sign in with Banno and sign in with your Banno Username and Password. You’ll be redirected to https://localhost:8080/me and see the OpenID Connect claims for the user.
After completing the auth flow, the browser will display something that looks similar to this example:
You’ll also see a log statement in the terminal that shows the access_token
, id_token
, and refresh_token
:
- The
access_token
contains authorization information about your application regarding which actions it is allowed to perform via the Consumer API. These actions map to the scopes (e.g. openid address email phone profile banno). - The
id_token
contains authentication information about the user (i.e. claims). - The
refresh_token
is a credential that can be used to retrieve a new access token (e.g. for when the access token has expired or otherwise been invalidated). - Both the
access_token
andid_token
are in JSON Web Token (JWT) format (see RFC 7519 for specification details).
Next steps
Congratulations! Continue your learning journey: