You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. Navigate to the Admin Portal example app within the cloned repo.
23
+
2. Navigate to the Admin Portal example app within the cloned repo.
29
24
```bash
30
25
$ cd python-django-example-applications/python-django-magic-link-example
31
26
```
32
27
33
28
### Install Dependencies
34
29
35
-
4. Create and source a Python virtual environment. You should then see `(env)` at the beginning of your command-line prompt.
30
+
3. Create and source a Python virtual environment. You should then see `(env)` at the beginning of your command-line prompt.
36
31
```bash
37
32
$ python3 -m venv env
38
33
$ source env/bin/activate
39
34
(env) $
40
35
```
41
36
42
-
5. Move in to the app directory and install the cloned app's dependencies.
37
+
4. Move in to the app directory and install the cloned app's dependencies.
43
38
```bash
44
39
(env) $ cd magic_link_example
45
40
(env) $ pip install -r requirements.txt
46
41
```
47
42
48
43
### Set Environment Variables
49
44
50
-
6. Obtain and make note of the following values. In the next step, these will be set as environment variables.
45
+
5. Obtain and make note of the following values. In the next step, these will be set as environment variables.
51
46
- Your [WORKOS_API_KEY](https://dashboard.workos.com/api-keys)
52
47
- Your `WORKOS_CLIENT_ID`, in the format `client_<random-alphanumeric-string>`, retrievable from WorkOS dashboard under Configuration.
53
48
54
-
7. Ensure you're in the root app directory for the example app, `magic_link_example/` where the `manage.py` file resides. Create a `.env` file to securely store the environment variables. Open this file with the Nano text editor. (This file is listed in this repo's `.gitignore` file, so your sensitive information will not be checked into version control.)
49
+
6. Ensure you're in the root app directory for the example app, `magic_link_example/` where the `manage.py` file resides. Create a `.env` file to securely store the environment variables. Open this file with the Nano text editor. (This file is listed in this repo's `.gitignore` file, so your sensitive information will not be checked into version control.)
55
50
```bash
56
51
(env) $ touch .env
57
52
(env) $ nano .env
58
53
```
59
54
60
-
8. Once the Nano text editor opens, you can directly edit the `.env` file by listing the environment variables:
55
+
7. Once the Nano text editor opens, you can directly edit the `.env` file by listing the environment variables:
61
56
```bash
62
57
export WORKOS_API_KEY=<value found in step 6>
63
58
export WORKOS_CLIENT_ID=<value found in step 6>
64
59
```
65
60
66
61
To exit the Nano text editor, type`CTRL + x`. When prompted to "Save modified buffer", type`Y`, then press the `Enter` or `Return` key.
67
62
68
-
9. Source the environment variables so they are accessible to the operating system.
63
+
8. Source the environment variables so they are accessible to the operating system.
69
64
```bash
70
65
(env) $ source .env
71
66
```
@@ -76,7 +71,7 @@ A basic Django app that uses the [WorkOS Python SDK](https://github.com/workos-i
76
71
(env) $ echo$WORKOS_CLIENT_ID
77
72
```
78
73
79
-
10. Run the Django migrations. Again, ensure you're in the `magic_link_example/` directory where the `manange.py` file is.
74
+
9. Run the Django migrations. Again, ensure you're in the `magic_link_example/` directory where the `manange.py` file is.
80
75
```bash
81
76
(env) $ python3 manage.py migrate
82
77
```
@@ -91,14 +86,14 @@ A basic Django app that uses the [WorkOS Python SDK](https://github.com/workos-i
91
86
. . .
92
87
```
93
88
94
-
11. Update the default redirect URI in your WorkOS Dashboard
89
+
10. Update the default redirect URI in your WorkOS Dashboard
95
90
96
91
To configure the page where the user will be redirected after logging in with the Magic Link you'll need to set the default redirect_uri to http://localhost:8000/success.
97
92
98
93
99
94
## Start the server
100
95
101
-
12. Start the server.
96
+
11. Start the server.
102
97
103
98
To serve static files in development while still having `debug=True`in settings.py to able to send requests to WorkOS, be sure to include the `--insecure` flag when starting the server locally.
104
99
```bash
@@ -118,7 +113,7 @@ A basic Django app that uses the [WorkOS Python SDK](https://github.com/workos-i
118
113
Quit the server with CONTROL-C.
119
114
```
120
115
121
-
13. Once the server is running, navigate to http://localhost:8000 to view the home page of the app where you can enter the email you'd like to send a Magic Link to. The app will send a Magic Link to the submitted email and also bring you to a page which also has the magic link included. Click on the link and you'll be logged in!
116
+
12. Once the server is running, navigate to http://localhost:8000 to view the home page of the app where you can enter the email you'd like to send a Magic Link to. The app will send a Magic Link to the submitted email and also bring you to a page which also has the magic link included. Click on the link and you'll be logged in!
0 commit comments