Skip to content

Commit fe12896

Browse files
committed
[Docs Site] Add index.md for CF1 docs
1 parent cf2f61a commit fe12896

File tree

4 files changed

+139
-3
lines changed

4 files changed

+139
-3
lines changed

package-lock.json

Lines changed: 77 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,12 @@
9797
"rehype-autolink-headings": "7.1.0",
9898
"rehype-external-links": "3.0.0",
9999
"rehype-parse": "9.0.1",
100+
"rehype-remark": "10.0.0",
100101
"rehype-stringify": "10.0.1",
101102
"rehype-title-figure": "0.1.2",
102103
"remark": "15.0.1",
104+
"remark-gfm": "4.0.1",
105+
"remark-stringify": "11.0.0",
103106
"sharp": "0.33.5",
104107
"solarflare-theme": "0.0.4",
105108
"starlight-image-zoom": "0.11.1",

src/content/docs/cloudflare-one/identity/one-time-pin.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ import { Tabs, TabItem, Render } from '~/components';
99

1010
Cloudflare Access can send a one-time PIN (OTP) to approved email addresses as an alternative to integrating an identity provider. You can simultaneously configure OTP login and the identity provider of your choice to allow users to select their own authentication method.
1111

12+
```sh
13+
curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/access/identity_providers \
14+
--header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
15+
--data '{
16+
"name": "One-time PIN login",
17+
"type": "onetimepin",
18+
"config": {}
19+
}'
20+
```
21+
1222
For example, if your team uses Okta but you are collaborating with someone outside your organization, you can use OTP to grant access to guests.
1323

1424
<Render file="access/one-time-pin-warning" />
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import type { APIRoute } from "astro";
2+
import type { InferGetStaticPropsType, GetStaticPaths } from "astro";
3+
4+
import { getCollection } from "astro:content";
5+
import { entryToString } from "~/util/container";
6+
7+
import { process } from "~/util/rehype";
8+
import rehypeParse from "rehype-parse";
9+
import rehypeFilterElements from "~/plugins/rehype/filter-elements";
10+
import remarkGfm from "remark-gfm";
11+
import rehypeRemark from "rehype-remark";
12+
import remarkStringify from "remark-stringify";
13+
14+
export const getStaticPaths = (async () => {
15+
const entries = await getCollection("docs", (e) => {
16+
return e.id.startsWith("cloudflare-one") && Boolean(e.body);
17+
});
18+
19+
return entries.map((entry) => {
20+
return {
21+
params: {
22+
entry: entry.id.replace("cloudflare-one/", ""),
23+
},
24+
props: {
25+
entry,
26+
},
27+
};
28+
});
29+
}) satisfies GetStaticPaths;
30+
31+
type Props = InferGetStaticPropsType<typeof getStaticPaths>;
32+
33+
export const GET: APIRoute<Props> = async (context) => {
34+
const html = await entryToString(context.props.entry, context.locals);
35+
36+
const md = await process(html, [
37+
rehypeParse,
38+
rehypeFilterElements,
39+
remarkGfm,
40+
rehypeRemark,
41+
remarkStringify,
42+
]);
43+
44+
return new Response(md, {
45+
headers: {
46+
"content-type": "text/markdown",
47+
},
48+
});
49+
};

0 commit comments

Comments
 (0)