You need to run this application to test the OpenAuth widget. This application is built with vite that redirects to the OpenAuth widget.
-
Clone the repository:
git clone https://github.com/aarc-xyz/open-auth-redirect
-
Navigate to the project directory:
cd open-auth-redirect
-
Install dependencies:
npm install
-
Refer to the Environment Variables section to configure the environment variables.
-
To start the project, run:
npm run dev
-
Configure
Redirect URL
in Stytch dashboard to your running app URL likehttp://localhost:5173/auth?state={}
To configure the environment variables for the project, follow these steps:
-
Copy the Example Environment File:
cp .env.example .env
This command creates a new
.env
file in the project root by copying the provided.env.example
file. -
Edit the
.env
File: Open the newly created.env
file in your preferred text editor. Replace the placeholder values with your actual configuration values. GetVITE_AUTHENTICATE_URL
andVITE_STAGING_AUTHENTICATE_URL
by running Open Auth Backend.VITE_TG_BOT_NAME
is used for authenticating with Telegram.VITE_AUTHENTICATE_URL="YOUR_BACKEND_PROD_URL/authenticate/" VITE_STAGING_AUTHENTICATE_URL="YOUR_BACKEND_STAGING_URL/authenticate/" VITE_TG_BOT_NAME="YOUR_TELEGRAM_BOT_NAME"
-
Save the Changes: After updating the values, save the
.env
file. If your project is already running, you may need to restart it for the changes to take effect.
The project will be available at http://localhost:5173
or next available port if 5173 is already in use.
Once the project is running, add the url
to redirectUrl
while configuring auth-widget
. This application's sole purpose is to redirect to the OpenAuth widget and is not meant to be used as a standalone application. You can learn about auth-widget
const config: AarcAuthWidgetConfig = {
// remaining config...
urls: {
stytchUrls: {
prod: "YOUR_STYTCH_PROD_URL",
staging: "https://test.stytch.com/",
},
pollUrls: {
prod: "YOUR_BACKEND_PROD_URL",
staging: "YOUR_BACKEND_STAGING_URL",
},
publicToken: {
prod: "YOUR_STYTCH_PROD_PUBLIC_TOKEN",
staging: "YOUR_STYTCH_STAGING_PUBLIC_TOKEN",
},
redirectUrl: {
// replace it with your running app url, it won't work with localhost so you can use tunneling services like ngrok.
prod: "RUNNING_APP_URL",
staging: "RUNNING_APP_URL",
},
},
};
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for more details.