Finished Moodle oAuth service
READ Moodle section in README file
This commit is contained in:
@@ -10,7 +10,6 @@ export const Authorize = ({ service }: { service: Service }) => {
|
||||
searchParams.get("redirect_uri")?.startsWith(url),
|
||||
);
|
||||
const { data: session } = useSession();
|
||||
console.log(session);
|
||||
if (!session)
|
||||
redirect("/login?redirect=" + encodeURIComponent(window.location.href));
|
||||
if (!legitimeUrl)
|
||||
@@ -37,7 +36,14 @@ export const Authorize = ({ service }: { service: Service }) => {
|
||||
className="btn btn-primary"
|
||||
onClick={async () => {
|
||||
const code = await generateToken(service);
|
||||
window.location.href = `${searchParams.get("redirect_uri")}?code=${code?.accessToken}`;
|
||||
const url = new URL(searchParams.get("redirect_uri") as string);
|
||||
url.searchParams.append("code", code?.accessToken as string);
|
||||
url.searchParams.append(
|
||||
"state",
|
||||
searchParams.get("state") as string,
|
||||
);
|
||||
|
||||
window.location.href = url.href;
|
||||
}}
|
||||
>
|
||||
Zulassen
|
||||
|
||||
Reference in New Issue
Block a user