@@ -8,11 +8,15 @@ The OAuthify library provides a seamless integration for adding OAuth-based logi
8
8
- ** Secure Authentication:** Redirects users to the respective service's login page and securely handles the OAuth callback.
9
9
- ** Customizable:** Allows for custom handling of successful or failed logins, enabling you to tailor the user experience.
10
10
11
+ <<<<<<< HEAD
11
12
<!--  -->
12
13
13
14
<p align =" center " >
14
15
<img src =" src/assets/OAuthify.png " alt =" OAuthify Auth 2.0 headless Component " width =" 200 " >
15
16
</p >
17
+ =======
18
+ ![ OAuthify Auth 2.0 headless Component] ( /src/assets/OAuthify.png )
19
+ >>>>>>> e254e27 (updated readme)
16
20
17
21
### Installation
18
22
@@ -45,10 +49,16 @@ import {
45
49
GoogleIcon ,
46
50
GithubIcon ,
47
51
} from ' oauthify' ;
52
+ <<<<<< < HEAD
53
+ ====== =
54
+ import { useAuth } from ' ./contexts/Auth.context' ;
55
+
56
+ >>>>>> > e254e27 (updated readme)
48
57
const googleClientId = ' xxxxxxxxx' ;
49
58
const githubClientId = ' XXXXXXXX' ;
50
59
51
60
const App = () => {
61
+ <<<<<< < HEAD
52
62
const handleSuccess = (response ) => {
53
63
console .log (' Google login success:' , response);
54
64
// Handle successful login, e.g., set user info in app state
@@ -59,6 +69,8 @@ const App = () => {
59
69
// Handle failed login, e.g., show error message to user
60
70
};
61
71
72
+ ====== =
73
+ >>>>>> > e254e27 (updated readme)
62
74
return (
63
75
< OAuthifyProvider>
64
76
< div>
@@ -70,6 +82,7 @@ const App = () => {
70
82
};
71
83
72
84
const LoginComponent = () => {
85
+ <<<<<< < HEAD
73
86
return (
74
87
<>
75
88
< div className= " flex flex-row justify-center items-center my-6 space-x-2" >
@@ -79,6 +92,28 @@ const LoginComponent = () => {
79
92
onSuccess= {handleSuccess}
80
93
onFailure= {handleFailure}
81
94
>
95
+ ====== =
96
+ const { onSuccess , onFailure , setOnSuccess } = useOAuthify ();
97
+
98
+ const handleSuccess = () => {
99
+ // Handle the success state of LoginWithGoogle or LoginWithGithub
100
+ };
101
+ const handleFailure = () => {
102
+ // Handle the success state of LoginWithGoogle or LoginWithGithub
103
+ };
104
+
105
+ React .useEffect (() => {
106
+ handleSuccess ();
107
+ }, [onSuccess]);
108
+
109
+ React .useEffect (() => {
110
+ handleFailure ();
111
+ }, [onFailure]);
112
+ return (
113
+ <>
114
+ < div className= " flex flex-row justify-center items-center my-6 space-x-2" >
115
+ < GoogleLoginButton clientId= {googleClientId} redirectUri= {redirectUri}>
116
+ >>>>>> > e254e27 (updated readme)
82
117
< div
83
118
style= {{
84
119
display: ' flex' ,
@@ -99,12 +134,16 @@ const LoginComponent = () => {
99
134
< / div> {' ' }
100
135
< / GoogleLoginButton>
101
136
137
+ <<<<<< < HEAD
102
138
< GitHubLoginButton
103
139
clientId= {githubClientId}
104
140
redirectUri= {redirectUri}
105
141
onSuccess= {handleSuccess}
106
142
onFailure= {handleFailure}
107
143
>
144
+ ====== =
145
+ < GitHubLoginButton clientId= {githubClientId} redirectUri= {redirectUri}>
146
+ >>>>>> > e254e27 (updated readme)
108
147
>
109
148
< div
110
149
style= {{
0 commit comments