Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Offline JWT validation in Go

This repository shows how to locally validate a JWT with Go. Please read the blog post for this repo to see how this example was created.


Okta has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage, and secure users and roles in any application.

Getting Started

To install this example, run the following commands:

git clone
cd okta-offline-jwt-validation-example
go get
go get

Create an Application in Okta

Log in to your Okta Developer account (or sign up if you don’t have an account).

  1. From the Applications page, choose Add Application.
  2. On the Create New Application page, select Single-Page App.
  3. Give your app a memorable name, add http://localhost:8080 as a Login redirect URI, then click Done.

There are two pieces of information that you need to obtain from the Okta Developer Console. These are your Okta domain name (e.g. and your client id (e.g. 0ab1c2defg3AB4Chi567).

Edit the file client/control.js and replace ${yourOktaDomain} and ${yourClientId} with the values you created above.

Return to your terminal and set the $OKTA_DOMAIN environment variable to your Okta domain name. Replace with your Okta domain name.

export OKTA_DOMAIN=""

Then use this command to run the example:

go run main.go

Next, point a web browser at http://localhost:8080.

Enter a message and hit the submit button. You should get an authorization error.

Now, login and try sending another message. This should send a token that gets validated correctly. Your message should be displayed.

Learn more by reading the blog post.

This example uses the following open source libraries:


Please post any questions as comments on the blog post, or on the Okta Developer Forums.


Apache 2.0, see LICENSE.


Offline JWT validation in Go



Code of conduct





No releases published


No packages published