Skip to content

Commit f1f5778

Browse files
committed
feat: add microsoft login
1 parent e8cb682 commit f1f5778

7 files changed

Lines changed: 6580 additions & 6521 deletions

File tree

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.1.7",
2+
"version": "1.1.8-beta.1",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",
@@ -65,6 +65,6 @@
6565
"typescript": "^4.9.3"
6666
},
6767
"dependencies": {
68-
"@authorizerdev/authorizer-js": "^1.1.2"
68+
"@authorizerdev/authorizer-js": "^1.1.4-beta.0"
6969
}
7070
}

src/components/AuthorizerSocialLogin.tsx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { createQueryParams } from '../utils/common';
99
import { LinkedIn } from '../icons/linkedin';
1010
import { Apple } from '../icons/apple';
1111
import { Twitter } from '../icons/twitter';
12+
import { Microsoft } from '../icons/microsoft';
1213

1314
export const AuthorizerSocialLogin: React.FC<{
1415
urlProps?: Record<string, any>;
@@ -20,7 +21,9 @@ export const AuthorizerSocialLogin: React.FC<{
2021
config.is_github_login_enabled ||
2122
config.is_facebook_login_enabled ||
2223
config.is_linkedin_login_enabled ||
23-
config.is_apple_login_enabled;
24+
config.is_apple_login_enabled ||
25+
config.is_twitter_login_enabled ||
26+
config.is_microsoft_login_enabled;
2427

2528
const data: {
2629
scope?: string;
@@ -47,7 +50,7 @@ export const AuthorizerSocialLogin: React.FC<{
4750
}}
4851
>
4952
<Apple />
50-
Sign in with Apple
53+
Continue with Apple
5154
</StyledButton>
5255
<br />
5356
</div>
@@ -61,7 +64,7 @@ export const AuthorizerSocialLogin: React.FC<{
6164
}}
6265
>
6366
<Google />
64-
Sign in with Google
67+
Continue with Google
6568
</StyledButton>
6669
<br />
6770
</>
@@ -75,7 +78,7 @@ export const AuthorizerSocialLogin: React.FC<{
7578
}}
7679
>
7780
<Github />
78-
Sign in with Github
81+
Continue with Github
7982
</StyledButton>
8083
<br />
8184
</>
@@ -89,7 +92,7 @@ export const AuthorizerSocialLogin: React.FC<{
8992
}}
9093
>
9194
<Facebook />
92-
Sign in with Facebook
95+
Continue with Facebook
9396
</StyledButton>
9497
<br />
9598
</>
@@ -103,7 +106,7 @@ export const AuthorizerSocialLogin: React.FC<{
103106
}}
104107
>
105108
<LinkedIn />
106-
Sign in with LinkedIn
109+
Continue with LinkedIn
107110
</StyledButton>
108111
<br />
109112
</>
@@ -117,7 +120,21 @@ export const AuthorizerSocialLogin: React.FC<{
117120
}}
118121
>
119122
<Twitter />
120-
Sign in with Twitter
123+
Continue with Twitter
124+
</StyledButton>
125+
<br />
126+
</>
127+
)}
128+
{config.is_microsoft_login_enabled && (
129+
<>
130+
<StyledButton
131+
appearance={ButtonAppearance.Default}
132+
onClick={() => {
133+
window.location.href = `${config.authorizerURL}/oauth_login/microsoft?${queryParams}`;
134+
}}
135+
>
136+
<Microsoft />
137+
Continue with Microsoft
121138
</StyledButton>
122139
<br />
123140
</>

src/contexts/AuthorizerContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const AuthorizerContext = createContext<AuthorizerContextPropsType>({
2727
is_linkedin_login_enabled: false,
2828
is_apple_login_enabled: false,
2929
is_twitter_login_enabled: false,
30+
is_microsoft_login_enabled: false,
3031
is_email_verification_enabled: false,
3132
is_basic_authentication_enabled: false,
3233
is_magic_link_login_enabled: false,
@@ -94,6 +95,7 @@ let initialState: AuthorizerState = {
9495
is_linkedin_login_enabled: false,
9596
is_apple_login_enabled: false,
9697
is_twitter_login_enabled: false,
98+
is_microsoft_login_enabled: false,
9799
is_email_verification_enabled: false,
98100
is_basic_authentication_enabled: false,
99101
is_magic_link_login_enabled: false,

src/icons/microsoft.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import React from 'react';
2+
3+
export const Microsoft = () => {
4+
return (
5+
<div
6+
style={{
7+
position: 'absolute',
8+
left: '10px',
9+
top: '12px',
10+
display: 'flex',
11+
}}
12+
>
13+
<svg
14+
xmlns="http://www.w3.org/2000/svg"
15+
viewBox="0 0 48 48"
16+
width="24px"
17+
height="24px"
18+
>
19+
<path fill="#ff5722" d="M6 6H22V22H6z" transform="rotate(-180 14 14)" />
20+
<path
21+
fill="#4caf50"
22+
d="M26 6H42V22H26z"
23+
transform="rotate(-180 34 14)"
24+
/>
25+
<path
26+
fill="#ffc107"
27+
d="M26 26H42V42H26z"
28+
transform="rotate(-180 34 34)"
29+
/>
30+
<path
31+
fill="#03a9f4"
32+
d="M6 26H22V42H6z"
33+
transform="rotate(-180 14 34)"
34+
/>
35+
</svg>
36+
</div>
37+
);
38+
};

src/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export type AuthorizerState = {
1515
is_linkedin_login_enabled: boolean;
1616
is_apple_login_enabled: boolean;
1717
is_twitter_login_enabled: boolean;
18+
is_microsoft_login_enabled: boolean;
1819
is_email_verification_enabled: boolean;
1920
is_basic_authentication_enabled: boolean;
2021
is_magic_link_login_enabled: boolean;
@@ -39,6 +40,7 @@ export type AuthorizerContextPropsType = {
3940
is_linkedin_login_enabled: boolean;
4041
is_apple_login_enabled: boolean;
4142
is_twitter_login_enabled: boolean;
43+
is_microsoft_login_enabled: boolean;
4244
is_email_verification_enabled: boolean;
4345
is_basic_authentication_enabled: boolean;
4446
is_magic_link_login_enabled: boolean;

0 commit comments

Comments
 (0)