-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [frontend] user can signup with /frontend/app/(guest-only)/signup/oauth
- Loading branch information
Showing
10 changed files
with
154 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsString } from 'class-validator'; | ||
|
||
export class OauthDto { | ||
@IsString() | ||
@ApiProperty() | ||
code: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { redirect } from "next/navigation"; | ||
|
||
const signupWith42 = () => { | ||
const response_type = "code"; | ||
const client_id = process.env.OAUTH_42_CLIENT_ID; | ||
const redirect_uri = process.env.OAUTH_REDIRECT_URI; | ||
const scope = "public"; | ||
const state = "42"; | ||
|
||
const url = | ||
"https://api.intra.42.fr/oauth/authorize?" + | ||
`&client_id=${client_id}` + | ||
`&redirect_uri=${redirect_uri}` + | ||
`&response_type=${response_type}` + | ||
`&scope=${scope}` + | ||
`&state=${state}`; | ||
redirect(url); | ||
}; | ||
|
||
export default signupWith42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { createUserWithOauth } from "@/app/lib/actions"; | ||
|
||
const Callback = async ({ | ||
searchParams, | ||
}: { | ||
searchParams?: { [key: string]: string | string[] | undefined }; | ||
}) => { | ||
if (searchParams === undefined) { | ||
return <h1>hoge</h1>; | ||
} | ||
console.log(searchParams); | ||
if (searchParams["code"] === undefined) { | ||
return <h1>hoge</h1>; | ||
} | ||
await createUserWithOauth(searchParams["code"], "42"); | ||
return <h1>hoge</h1>; | ||
}; | ||
|
||
export default Callback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters