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
Copy file name to clipboardExpand all lines: README.md
+72-3Lines changed: 72 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ This repo contains our openAPI specifications, as well as a demo ecommerce web a
15
15
16
16
The Canva Connect API doesn't maintain nor publish client SDKs, however, we have made our [OpenAPI spec](./openapi/spec.yml) publicly available, so you can use it with your favorite code generation library, such as [openapi-generator](https://github.com/OpenAPITools/openapi-generator) to generate client SDKs in your language of choice!
17
17
18
-
To demonstrate this, we're using [openapi-ts](https://www.npmjs.com/package/@hey-api/openapi-ts) to generate TypeScript SDKs in [client/ts](./client//ts/) which is used in our demo app.
18
+
To demonstrate this, we're using [openapi-ts](https://www.npmjs.com/package/@hey-api/openapi-ts) to generate TypeScript SDKs in [client/ts](./client/ts/) which is used in our demo app.
19
19
20
20
## Demos: E-commerce Shop
21
21
@@ -63,7 +63,7 @@ cd demos/ecommerce_shop
63
63
64
64
2. Add your integration settings to the `demos/ecommerce_shop/.env` file.
65
65
66
-
-`DATABASE_ENCRYPTION_KEY`: This will encrypt and decrypt the tokens stored in the JSON database. A key is automatically get generated for you after running `npm install`, and will already be set in `.env`. If not, run `npm run generate:db-key` from the `demos/ecommerce_shop` directory.
66
+
-`DATABASE_ENCRYPTION_KEY`: This will encrypt and decrypt the tokens stored in the JSON database. A key is automatically generated for you after running `npm install`, and will already be set in `.env`. If not, run `npm run generate:db-key` from the `demos/ecommerce_shop` directory.
67
67
-`CANVA_CLIENT_ID`: This is the `Client ID` from the prerequisites.
68
68
-`CANVA_CLIENT_SECRET`: This is the `client secret` you generated in the prerequisites.
69
69
@@ -78,6 +78,75 @@ npm start
78
78
79
79
4. View your app: [http://127.0.0.1:3000](http://127.0.0.1:3000)
80
80
81
+
### Brand Templates Setup
82
+
83
+
To get started with Brand Templates in the e-commerce demo, you can install sample templates from [this Brand Template deck](https://www.canva.com/design/DAGGkcb61HQ/OJhMIQrmz2daIoxo8u3T2g/view).
84
+
85
+
## Demos: Real-estate demo
86
+
87
+
### Prerequisites
88
+
89
+
Before you can run this demo, you'll need to do some setup beforehand.
90
+
91
+
1. Open the [Developer Portal](https://www.canva.com/developers/integrations/connect-api), and click `Create an integration`.
92
+
93
+
2. Under `Configuration` → `Configure your integration`.
94
+
95
+
-`Integration name`: Add a name.
96
+
-`Client ID`: Make a note of this value; you'll need it in a later step.
97
+
-`Generate secret`: Click this and save the secret in a secure location, as you'll need it for a later step.
98
+
99
+
3. Under `Scopes` → `Set the scopes`, check the following boxes:
100
+
101
+
-`asset`: Read and Write.
102
+
-`brandtemplate:content`: Read.
103
+
-`brandtemplate:meta`: Read.
104
+
-`design:content`: Read and Write.
105
+
-`design:meta`: Read.
106
+
-`profile`: Read.
107
+
108
+
4. Under `Authentication` → `Add Authentication`, locate `URL 1` and enter the following value:
109
+
110
+
```
111
+
http://127.0.0.1:3001/oauth/redirect
112
+
```
113
+
114
+
5. Under `Return navigation`, toggle on the `Enable return navigation` switch and enter the following as the `Return Url`:
115
+
116
+
```
117
+
http://127.0.0.1:3001/return-nav
118
+
```
119
+
120
+
### How to run
121
+
122
+
1. Install dependencies
123
+
124
+
```bash
125
+
npm install
126
+
cd demos/realty
127
+
```
128
+
129
+
2. Add your integration settings to the `demos/realty/.env` file.
130
+
131
+
-`DATABASE_ENCRYPTION_KEY`: This will encrypt and decrypt the tokens stored in the JSON database. A key is automatically generated for you after running `npm install`, and will already be set in `.env`. If not, run `npm run generate:db-key` from the `demos/realty` directory.
132
+
-`CANVA_CLIENT_ID`: This is the `Client ID` from the prerequisites.
133
+
-`CANVA_CLIENT_SECRET`: This is the `client secret` you generated in the prerequisites.
134
+
135
+
3. Run the app
136
+
137
+
```bash
138
+
npm start
139
+
```
140
+
141
+
> [!WARNING]
142
+
> Accessing the app via `localhost:3000` will throw CORS errors, you must access the app via the below URL.
143
+
144
+
4. View your app: [http://127.0.0.1:3000](http://127.0.0.1:3000)
145
+
146
+
### Brand Templates Setup
147
+
148
+
To get started with Brand Templates in the real estate demo, you can install sample templates from [this Brand Template deck](https://www.canva.com/design/DAGGkcb61HQ/OJhMIQrmz2daIoxo8u3T2g/view).
149
+
81
150
## Demos: Connect API Playground
82
151
83
152
### Prerequisites
@@ -113,7 +182,7 @@ cd demos/playground
113
182
114
183
2. Add your integration settings to the `demos/playground/.env` file.
115
184
116
-
-`DATABASE_ENCRYPTION_KEY`: This will encrypt and decrypt the tokens stored in the JSON database. A key is automatically get generated for you after running `npm install`, and will aready be set in `.env`.
185
+
-`DATABASE_ENCRYPTION_KEY`: This will encrypt and decrypt the tokens stored in the JSON database. A key is automatically generated for you after running `npm install`, and will already be set in `.env`.
117
186
-`CANVA_CLIENT_ID`: This is the `Client ID` from the prerequisites.
118
187
-`CANVA_CLIENT_SECRET`: This is the `client secret` you generated in the prerequisites.
To get started with Brand Templates, you can install sample templates from [this Brand Template deck](https://www.canva.com/design/DAGGkcb61HQ/OJhMIQrmz2daIoxo8u3T2g/view).
16
+
17
+
[See the main README for e-commerce shop demo instructions](../../README.md#demos-e-commerce-shop)
0 commit comments