Step 1: Create Your Free Okta Account
Okta's free developer offering used to be called "Developer Edition." That was retired in 2025 — if a tutorial mentions "Developer Edition," it's outdated. The current free offering is the Integrator Free Plan, which is what we use throughout this course, at no cost.
- Go to
developer.okta.com/signup/. - You'll be shown a choice of products — select the Okta Platform tile.
- Click Sign up for Integrator Free Plan.
- Enter your name, location, and an email address.
- Check your email for a verification link. Clicking it will also reveal your unique Org domain — something like
integrator-551224.okta.com. Write this down; it goes into.env.localshortly. - Set your password and set up Okta Verify (Okta's own authenticator app) or another authenticator on your phone — this protects your admin login, separate from the end-user login flow we build for TaskFlow.
- You'll land on the Okta Admin Console — your control panel for everything: users, groups, applications, security policies. Keep it open.
Step 2: Register Your First Application
- In the Admin Console, go to Applications → Applications.
- Click Create App Integration.
- Sign-in method: choose OIDC — OpenID Connect.
- Application type: choose Web Application. This matters — Next.js has a real backend (Route Handlers), so it can safely hold a Client Secret, unlike a browser-only Single-Page App.
- Click Next, then fill in:
- App integration name:
TaskFlow - Grant type: Leave Authorization Code checked.
- Sign-in redirect URIs:
http://localhost:3000/api/auth/callback - Sign-out redirect URIs:
http://localhost:3000 - Assignments: leave the default (Allow everyone in your organization to access) for now.
- App integration name:
- Click Save.
You'll land on the Application's page. Two values matter here:
- Client ID — visible directly on the page.
- Client Secret — click Show to reveal it. Treat this like a password; never commit it to Git or expose it in browser-side code.
Important — Verify Assignments Explicitly, Don't Just Trust the Default
Even with "Allow everyone" selected, it's worth actually confirming this for whatever account you'll test with. Go to the Assignments tab on this Application's page and check that the specific user you plan to log in with (whether that's your original admin account or a separate test user you create later under Directory → People) genuinely shows up in that list. If a test user was created after this setting was configured, or if "Everyone" isn't behaving as expected, you'll see a "User is not assigned to the client application" error the moment you try to log in — so checking this now saves a debugging detour later. If you ever do hit that exact error, come back here and click Assign → Assign to People, select the user, and save.
Step 3: Configure the Authorization Server's Access Policy — Do Not Skip This
This is the step that's easy to skip and causes a confusing failure later, so it gets its own careful walkthrough. Recall from Lecture 2: every Okta Org has a default Custom Authorization Server, literally named default, which is the one this entire course uses (you'll see /oauth2/default/ in every URL going forward). On Integrator Free Plan orgs, this server exists automatically — but it does not come with a working access policy out of the box, and without one, Okta will reject every single token request with "Policy evaluation failed for this request" — even if login itself (password + MFA) succeeds.
Here's exactly how to set it up correctly:
- Go to Security → API → Authorization Servers.
- Click on the server named
default. - Click the Access Policies tab.
- If the list is empty, click Add New Access Policy.
- Name: anything descriptive, e.g.
TaskFlow policy - Description: anything, e.g.
Allows TaskFlow to request tokens - Assigned to clients: select All Clients
- Click Create Policy.
- Name: anything descriptive, e.g.
- Your new policy now exists, but — critically — it still has zero rules, and a policy with no rules approves nothing. You must add at least one rule:
- Click Add rule.
- Rule Name: something like
Allow TaskFlow login - Grant type is: make sure Authorization Code is checked (this is the flow our entire app uses, from Lecture 2 onward). The other pre-checked options (Client Credentials, Device Authorization) can stay checked too — they just won't be used by our app, and having them checked doesn't cause any issue.
- User is: select Any user assigned the app.
- Scopes requested: select Any scopes — this is the simplest option and comfortably covers the
openid profile emailscopes our login route requests, plusoffline_accesswhen we add it in Phase 3. - Access token lifetime: the default of 1 Hour is fine and matches what Phase 3's silent renewal logic expects.
- Refresh token lifetime: the default of 90 Days is fine.
- Click Create rule.
- Confirm the policy shows Active, and the rule inside it shows Enabled.
To be completely explicit about why this matters: the Access Policy you just built governs whether a token request itself — this specific app, these specific scopes, this specific grant type — is permitted at all. This is a separate concern from the Authentication Policy (which governs how a user proves their identity — password, MFA, etc., covered properly in Phase 4). Both have to independently allow the request for login to succeed. Skipping this step is the single most common reason a beginner gets through Okta's password and MFA screens successfully, only to land on a confusing "Bad Request" page immediately after.
Step 4: Create the Next.js Project
You need Node.js 20.9 or later — check with node -v first.
Run:
npx create-next-app@latest taskflow --typescript --tailwind --eslint --app --src-dir --import-alias "@/*"
What each flag does:
--typescript— scaffolds with TypeScript and a pre-configuredtsconfig.json.--tailwind— installs Tailwind CSS. As of Tailwind CSS v4 (whatcreate-next-appinstalls today), there's notailwind.config.jsfor basic theming anymore — customization happens insideglobals.cssvia an@themeblock. We'll touch this when styling the login UI.--eslint— adds linting with Next.js's recommended rules.--app— uses the App Router (theapp/directory), not the older Pages Router. Route Handlers, Middleware, and Server Components — everything this course depends on — are App Router features.--src-dir— puts app code insidesrc/, separate from root config files.--import-alias "@/*"— enablesimport { x } from "@/components/x"instead of long relative paths.
Once scaffolding finishes:
cd taskflow npm run dev
Visit http://localhost:3000 — you should see the default Next.js welcome page, styled with Tailwind.
Step 5: Store Your Okta Credentials Safely
In the root of taskflow, create .env.local:
OKTA_ORG_URL=https://integrator-5454524.okta.com OKTA_CLIENT_ID=your_client_id_here OKTA_CLIENT_SECRET=your_client_secret_here
Replace the values with your actual Org domain, Client ID, and Client Secret from Step 2. create-next-app already adds .env*.local to .gitignore — open .gitignore once and confirm that line is genuinely there before going further.
A Quick Pre-Flight Checklist Before Moving to Phase 2
Before writing any login code, confirm all three of these are true — each one maps to an error you'd otherwise hit later:
- Application created as Web Application, redirect URIs exactly match
http://localhost:3000/api/auth/callbackandhttp://localhost:3000. - The test user you intend to log in with is genuinely visible under the Application's Assignments tab.
- The
defaultAuthorization Server has an Active Access Policy containing at least one Enabled rule that allows the Authorization Code grant type.
If all three are true, you're correctly set up, and the login flow built in Phase 2 will work without the detours we just went through.
No comments:
Post a Comment