Skip to content

Commit

Permalink
adicionando o login via Github
Browse files Browse the repository at this point in the history
  • Loading branch information
pablogeokar committed Sep 29, 2024
1 parent 11af080 commit 91b94a2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
AUTH_SECRET="AUTH_SECRET_KEY" # Added by `npx auth`. Read more: https://cli.authjs.dev
AUTH_TRUST_HOST=true
AUTH_GITHUB_SECRET="GITHUB_SECRET_KEY"
AUTH_GITHUB_ID="GITHUB_ID"
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ pnpm dlx shadcn@latest add card button form input
5 - Iniciando a configuração do Next-Auth
```bash
pnpm dlx auth secret
```
```
6 - Passo a passo para a configuração social do Github
6.1 acessar o endereço: `https://github.com/settings/apps`
selecionar a opção [OAuth Apps]->[New OAuth App] e seguir os passos necessários, lembrando que é necessário informar a Authorization callback no formato: `http://localhost:3000/api/auth/callback/github`
6 changes: 3 additions & 3 deletions app/auth/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";

//import { GitHubLogoIcon } from "@radix-ui/react-icons";
import { GitHubLogoIcon } from "@radix-ui/react-icons";

import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
Expand Down Expand Up @@ -106,10 +106,10 @@ export default function SignIn() {
or
</span>
<form className="w-full" action={handleGithubSignin}>
{/* <Button variant="outline" className="w-full" type="submit">
<Button variant="outline" className="w-full" type="submit">
<GitHubLogoIcon className="h-4 w-4 mr-2" />
Sign in with GitHub
</Button> */}
</Button>
</form>
</CardContent>
</Card>
Expand Down
3 changes: 2 additions & 1 deletion auth.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import NextAuth from "next-auth";
import Credentials from "next-auth/providers/credentials";
import async from "./app/page";
import Github from "next-auth/providers/github";
import { signInSchema } from "./lib/zod";

export const { handlers, signIn, signOut, auth } = NextAuth({
providers: [
Github,
Credentials({
credentials: {
email: { label: "Email", type: "email", placeholder: "seu@email.com" },
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"dependencies": {
"@hookform/resolvers": "^3.9.0",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0",
"class-variance-authority": "^0.7.0",
Expand Down
12 changes: 12 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 91b94a2

Please sign in to comment.