20 | You are logged in, and a Session has been created. The SDK stores the Session as a token and
21 | a JWT in the browser cookies as
22 | stytch_session and
23 | stytch_session_jwt respectively.
24 |
6 |
7 | ## Overview
8 |
9 | This example application demonstrates how one may use Stytch within a Vue application. This project was bootstrapped with [create-vue](https://github.com/vuejs/create-vue).
10 |
11 | This project uses Stytch's [JavaScript SDK](https://stytch.com/docs/sdks/javascript-sdk) which provides pre-built UI components and headless methods to securely interact with Stytch.
12 |
13 | This application features Email Magic Links for authentication, as well as our Sessions Management product to manage user sessions. You can use this application's source code as a learning resource, or use it as a jumping off point for your own project. We are excited to see what you build with Stytch!
14 |
15 | ## Set up
16 |
17 | Follow the steps below to get this application fully functional and running using your own Stytch credentials.
18 |
19 | ### In the Stytch Dashboard
20 |
21 | 1. Create a [Stytch](https://stytch.com/) account. Once your account is set up a Project called "My first project" will be automatically created for you.
22 |
23 | 2. Within your new Project, navigate to [SDK configuration](https://stytch.com/dashboard/sdk-configuration), and make the following changes:
24 |
25 | - Click **Enable SDK**.
26 | - Under **Authorized environments** add the domain `http://localhost:3000`.
27 |
28 |
29 | - Within the **Email Magic Links** drawer, toggle on **Enable the LoginOrCreate Flow**.
30 |
31 |
32 | 3. Navigate to [Redirect URLs](https://stytch.com/dashboard/redirect-urls), and add `http://localhost:3000` as the types **Login** and **Sign-up**.
33 |
34 |
35 | 4. Finally, navigate to [API Keys](https://stytch.com/dashboard/api-keys), and copy your `public_token`. You will need this value later on.
36 |
37 | ### On your machine
38 |
39 | In your terminal clone the project and install dependencies:
40 |
41 | ```bash
42 | git clone https://github.com/stytchauth/stytch-vue-example.git
43 | cd stytch-vue-example
44 | npm i
45 | ```
46 |
47 | Next, create `.env.local` file by running the command below and your `public_token`. Learn more about Vue's support for [custom environment variables here](https://cli.vuejs.org/guide/mode-and-env.html#environment-variables).
48 |
49 | ```bash
50 | echo "VITE_STYTCH_PUBLIC_TOKEN=YOUR_TOKEN_HERE" > .env.local
51 | # For example, echo "VITE_STYTCH_PUBLIC_TOKEN=public-token-test-123abcd-1234-1234-abcd-123123abcabc" > .env.local
52 | ```
53 |
54 | ## Running locally
55 |
56 | After completing all the set up steps above the application can be run with the command:
57 |
58 | ```bash
59 | npm run dev
60 | ```
61 |
62 | The application will be available at [`http://localhost:3000`](http://localhost:3000).
63 |
64 | You'll be able to login with Email Magic Links and see your Stytch User object, Stytch Session, and see how logging out works.
65 |
66 | ## Next steps
67 |
68 | This example app showcases a small portion of what you can accomplish with Stytch. Here are a few ideas to explore:
69 |
70 | 1. Add additional login methods like [Passwords](https://stytch.com/docs/passwords#guides_getting-started-sdk).
71 | 2. Replace the prebuilt UI with your own using by using the SDK's [headless methods](https://stytch.com/docs/sdks/javascript-sdk).
72 | 3. Add a Google OAuth button with the high converting [Google One Tap UI](https://stytch.com/docs/oauth#guides_google-sdk).
73 | 4. Secure your app further by building MFA authentication using methods like [WebAuthn](https://stytch.com/docs/sdks/javascript-sdk#webauthn).
74 | 5. Use [Stytch Sessions](https://stytch.com/docs/sessions) to secure your backend.
75 |
76 | ## Get help and join the community
77 |
78 | #### :speech_balloon: Stytch community Slack
79 |
80 | Join the discussion, ask questions, and suggest new features in our [Slack community](https://stytch.com/docs/resources/support/overview)!
81 |
82 | #### :question: Need support?
83 |
84 | Check out the [Stytch Forum](https://forum.stytch.com/) or email us at [support@stytch.com](mailto:support@stytch.com).
85 |
--------------------------------------------------------------------------------
/public/logo.svg:
--------------------------------------------------------------------------------
1 |
16 |
--------------------------------------------------------------------------------