-
Notifications
You must be signed in to change notification settings - Fork 65
How to embed setup instructions into a blog post with the Okta CLI Template
In order to save our team time when writing blog posts, @mraible created a dynamic template that can be used to embed instructions into any blog post.
This page describes how to use this template.
To get started, try putting this into your blog post:
{% include setup/cli.md type="web" %}
When that template is rendered, it will expand to look like this:
Before you begin, you’ll need a free Okta developer account. Install the Okta CLI and run
okta register
to sign up for a new account. If you already have an account, runokta login
.Then, run
okta apps create
. Select the default app name, or change it as you see fit. Choose Web and press Enter.Select Other. Accept the default Redirect URI values provided for you.
The Okta CLI will create an OIDC Web App in your Okta Org. It will add the redirect URIs you specified and grant access to the Everyone group. You will see output like the following when it’s finished:
Okta application configuration has been written to: /path/to/app/.okta.env
Run cat
.okta.env
(ortype .okta.env
on Windows) to see the issuer and credentials for your app.export OKTA_OAUTH2_ISSUER="https://dev-133337.okta.com/oauth2/default" export OKTA_OAUTH2_CLIENT_ID="0oab8eb55Kb9jdMIr5d6" export OKTA_OAUTH2_CLIENT_SECRET="NEVER-SHOW-SECRETS"
Your Okta domain is the first part of your issuer, before
/oauth2/default
.NOTE: You can also use the Okta Admin Console to create your app. See Create a Web App for more information.
Here are some real world examples of how to use the CLI template:
{% include setup/cli.md type="spa" framework="Angular" loginRedirectUri="http://localhost:4200/callback" %}
{% include setup/cli.md type="web" framework="Okta Spring Boot Starter" %}
{% include setup/cli.md type="web" loginRedirectUri="http://localhost:8080/authorization-code/callback" %}
{% include setup/cli.md type="native" loginRedirectUri="com.okta.dev-133337:/callback" logoutRedirectUri="com.okta.dev-133337:/callback" %}
The CLI template is located in _source/_includes/setup/cli.md
The best way to learn how to use the CLI template is to read the source directly, since this document will likely go out of date. However, here are the basics to get you started.
The CLI template is implemented as a Jekyll Include and the output of the CLI template is controlled using the following include variables:
Name | Purpose | Values |
---|---|---|
adoc |
If set to any value, HTML links will be rendered in the AsciiDoc syntax. | string |
framework |
Which framework should be selected in the CLI | string |
loginRedirectUri |
The URI where Okta will send users after a successful login | string |
logoutRedirectUri |
The URI where Okta will send users after they have logged out | string |
note |
Additional instructions to include at the end. Use Markdown or AsciiDoc as approprate | string |
signup |
Will suppress the signup instructions if set to false
|
false , string
|
type |
What type of OIDC application to include instructions for |
jhipster , native , service , spa , web
|