This app shows Miro's OAuth2.0 flow from Miro to a client-side app built with Next.js.
NextJS-OAuth-app-demo.mov
- Included Features
- Tools and Technologies
- Prerequisites
- Associated Developer Tutorial
- Deploy the app on AWS Amplify
- Run the app locally
- Folder Structure
- Contributing
- License
- You have a Miro account.
- You're signed in to Miro.
- Your Miro account has a Developer team.
- Create a new app in Miro
- Your development environment includes Node.js 14.13 or a later version.
- All examples use
npm
as a package manager andnpx
as a package runner.
If you want to understand how to deploy the app to AWS Amplify or Azure (Static Web Apps), please watch the video below. Otherwise, skip to the next section to see how to run this locally.
If you want to understand how to deploy the app to Microsoft Azure (Static Web Apps) please watch the video below.
If you want to understand how to deploy the app to Netlify please watch the video below.
-
Run
yarn install
to install dependencies. -
Rename the
.sample.env
file to.env
and then add in your clientID, client Secret, and keep the redirect URL the same. -
Open the app manifest editor by clicking Edit in Manifest.
In the app manifest editor, copy and paste the following yaml code:
# See https://developers.miro.com/docs/app-manifest on how to use this
appName: NextJS OAuth
sdkUri: "http://localhost:3000"
redirectUris:
- http://localhost:3000/api/redirect/
scopes:
- boards:read
- boards:write
-
Run
yarn dev
. -
Once your server is up and running, go to http://localhost:3000/ in your browser. If the project is running successfully, you should see a Sign in button in the UI. Then go through the OAuth flow. If all went well, you should see
Signed in Successfully
. Great job!
.
βββ package.json <-- The dependencies for the app.
βββ .env <-- A file will create, where you store sensitive credentials (client ID, client secret).
βββ .sample.env <-- A file with a template to store store sensitive credentials (client ID, client secret).
βββ node_modules <-- Node.js modules that are installed based on dependencies.
βββ pages
βββ api
βββ authenticate.js <-- Checks user auth status.
βββ redirect.js <-- Handles redirect after successful authorization to get access token.
βββ signin.js <-- Handles OAuth authorization.
βββ _app.js <-- Main _app.js file for Next.js app.
βββ _document.js <-- Next.js import file.
βββ index.js <-- Main index.js file for basic UI functions.
βββ public
βββ favicon.ico <-- App icon for the browser tab.
βββ styles
βββ globals.css <-- CSS styling.
If you want to contribute to this example, or any other Miro Open Source project, please review Miro's contributing guide.