Skip to content

Commit

Permalink
add support for roblox
Browse files Browse the repository at this point in the history
  • Loading branch information
lakhansamani committed May 1, 2024
1 parent a59f491 commit f4fbf8c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 10 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"typescript": "^5.2.2"
},
"dependencies": {
"@authorizerdev/authorizer-js": "^2.0.2",
"@authorizerdev/authorizer-js": "^2.0.3",
"validator": "^13.11.0"
}
}
18 changes: 17 additions & 1 deletion src/components/AuthorizerSocialLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Apple } from '../icons/apple';
import { Twitter } from '../icons/twitter';
import { Microsoft } from '../icons/microsoft';
import { Twitch } from '../icons/twitch';
import { Roblox } from '../icons/roblox';

export const AuthorizerSocialLogin: React.FC<{
urlProps?: Record<string, any>;
Expand All @@ -25,7 +26,8 @@ export const AuthorizerSocialLogin: React.FC<{
config.is_apple_login_enabled ||
config.is_twitter_login_enabled ||
config.is_microsoft_login_enabled ||
config.is_twitch_login_enabled;
config.is_twitch_login_enabled ||
config.is_roblox_login_enabled;

const data: {
scope?: string;
Expand Down Expand Up @@ -161,6 +163,20 @@ export const AuthorizerSocialLogin: React.FC<{
<br />
</>
)}
{config.is_roblox_login_enabled && (
<>
<StyledButton
appearance={ButtonAppearance.Default}
onClick={() => {
window.location.href = `${config.authorizerURL}/oauth_login/roblox?${queryParams}`;
}}
>
<Roblox />
Continue with Roblox
</StyledButton>
<br />
</>
)}
{hasSocialLogin &&
(config.is_basic_authentication_enabled ||
config.is_mobile_basic_authentication_enabled ||
Expand Down
8 changes: 6 additions & 2 deletions src/contexts/AuthorizerContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const AuthorizerContext = createContext<AuthorizerContextPropsType>({
is_twitter_login_enabled: false,
is_microsoft_login_enabled: false,
is_twitch_login_enabled: false,
is_roblox_login_enabled: false,
is_email_verification_enabled: false,
is_basic_authentication_enabled: false,
is_magic_link_login_enabled: false,
Expand Down Expand Up @@ -101,6 +102,7 @@ let initialState: AuthorizerState = {
is_twitter_login_enabled: false,
is_microsoft_login_enabled: false,
is_twitch_login_enabled: false,
is_roblox_login_enabled: false,
is_email_verification_enabled: false,
is_basic_authentication_enabled: false,
is_magic_link_login_enabled: false,
Expand Down Expand Up @@ -142,8 +144,10 @@ export const AuthorizerProvider: FC<{
);

const getToken = async () => {
const { data: metaRes, errors: metaResErrors } =
await authorizerRef.current.getMetaData();
const {
data: metaRes,
errors: metaResErrors,
} = await authorizerRef.current.getMetaData();
try {
if (metaResErrors && metaResErrors.length) {
throw new Error(metaResErrors[0].message);
Expand Down
19 changes: 19 additions & 0 deletions src/icons/roblox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

export const Roblox = () => {
return (
<div
style={{
position: 'absolute',
left: '10px',
top: '12px',
display: 'flex',
}}
>
<img
src="https://authorizer.dev/_next/image?url=%2Fimages%2Froblox.png&w=24&q=24"
alt="roblox_logo"
/>
</div>
);
};
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type AuthorizerConfig = {
is_twitter_login_enabled: boolean;
is_microsoft_login_enabled: boolean;
is_twitch_login_enabled: boolean;
is_roblox_login_enabled: boolean;
is_email_verification_enabled: boolean;
is_basic_authentication_enabled: boolean;
is_magic_link_login_enabled: boolean;
Expand Down Expand Up @@ -48,6 +49,7 @@ export type AuthorizerContextPropsType = {
is_twitter_login_enabled: boolean;
is_microsoft_login_enabled: boolean;
is_twitch_login_enabled: boolean;
is_roblox_login_enabled: boolean;
is_email_verification_enabled: boolean;
is_basic_authentication_enabled: boolean;
is_magic_link_login_enabled: boolean;
Expand Down

0 comments on commit f4fbf8c

Please sign in to comment.