Oops we forgot the scope
This commit is contained in:
@@ -2,27 +2,17 @@ import { Button, Card, Container, Heading, VStack } from "@chakra-ui/react";
|
|||||||
import { useLoaderData } from "@remix-run/react";
|
import { useLoaderData } from "@remix-run/react";
|
||||||
|
|
||||||
export async function loader({ context }: { context: RequestContext }) {
|
export async function loader({ context }: { context: RequestContext }) {
|
||||||
const state = crypto.randomUUID().replace(/-/g, "");
|
|
||||||
const url = new URL(context.request.url);
|
const url = new URL(context.request.url);
|
||||||
url.pathname = "/api/data-requests/session";
|
url.pathname = "/api/data-requests/session";
|
||||||
|
|
||||||
await context.env.DATA.put(
|
|
||||||
`rbxstate_${state}`,
|
|
||||||
context.request.headers.get("cf-connecting-ip") ?? "",
|
|
||||||
{
|
|
||||||
expirationTtl: 300,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
client_id: context.env.ROBLOX_OAUTH_CLIENT_ID,
|
client_id: context.env.ROBLOX_OAUTH_CLIENT_ID,
|
||||||
state,
|
|
||||||
url: encodeURIComponent(url.href),
|
url: encodeURIComponent(url.href),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
const { client_id, state, url } = useLoaderData<typeof loader>();
|
const { client_id, url } = useLoaderData<typeof loader>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container pt="16vh">
|
<Container pt="16vh">
|
||||||
@@ -34,7 +24,7 @@ export default function () {
|
|||||||
as="a"
|
as="a"
|
||||||
borderRadius="24px"
|
borderRadius="24px"
|
||||||
colorScheme="blue"
|
colorScheme="blue"
|
||||||
href={`https://apis.roblox.com/oauth/v1/authorize?client_id=${client_id}&redirect_uri=${url}&response_type=code&state=${state}`}
|
href={`https://apis.roblox.com/oauth/v1/authorize?client_id=${client_id}&redirect_uri=${url}&response_type=code&scope=openid%20profile`}
|
||||||
>
|
>
|
||||||
Log in with Roblox
|
Log in with Roblox
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user