Rename Unintuitive Function Names in Authentication Flow (#9706)
Resolves #9623 ## Description This PR renames the following functions to better reflect their purpose. - Backend: - Verify → GetAuthTokensFromLoginToken - Challenge → GetLoginTokenFromCredentials - Frontend: - challenge → getLoginTokenFromCredentials - verify → getAuthTokensFromLoginToken ## Testing _Sign in works as expected:_ https://github.com/user-attachments/assets/7e8f73c7-2c7d-4cd2-9965-5ad9f5334cd3 _Sign up works as expected:_ https://github.com/user-attachments/assets/d1794ee4-8b59-4934-84df-d819eabd5224 --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { gql } from '@apollo/client';
|
||||
import * as Apollo from '@apollo/client';
|
||||
import { gql } from '@apollo/client';
|
||||
export type Maybe<T> = T | null;
|
||||
export type InputMaybe<T> = Maybe<T>;
|
||||
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
||||
@ -395,6 +395,7 @@ export enum FeatureFlagKey {
|
||||
IsJsonFilterEnabled = 'IsJsonFilterEnabled',
|
||||
IsLocalizationEnabled = 'IsLocalizationEnabled',
|
||||
IsMicrosoftSyncEnabled = 'IsMicrosoftSyncEnabled',
|
||||
IsNewRelationEnabled = 'IsNewRelationEnabled',
|
||||
IsPostgreSQLIntegrationEnabled = 'IsPostgreSQLIntegrationEnabled',
|
||||
IsStripeIntegrationEnabled = 'IsStripeIntegrationEnabled',
|
||||
IsUniqueIndexesEnabled = 'IsUniqueIndexesEnabled',
|
||||
@ -554,7 +555,6 @@ export type Mutation = {
|
||||
activateWorkflowVersion: Scalars['Boolean'];
|
||||
activateWorkspace: Workspace;
|
||||
authorizeApp: AuthorizeApp;
|
||||
challenge: LoginToken;
|
||||
checkoutSession: BillingSessionOutput;
|
||||
computeStepOutputSchema: Scalars['JSON'];
|
||||
createDraftFromWorkflowVersion: WorkflowVersion;
|
||||
@ -581,7 +581,9 @@ export type Mutation = {
|
||||
executeOneServerlessFunction: ServerlessFunctionExecutionResult;
|
||||
generateApiKeyToken: ApiKeyToken;
|
||||
generateTransientToken: TransientToken;
|
||||
getAuthTokensFromLoginToken: AuthTokens;
|
||||
getAuthorizationUrl: GetAuthorizationUrlOutput;
|
||||
getLoginTokenFromCredentials: LoginToken;
|
||||
getLoginTokenFromEmailVerificationToken: LoginToken;
|
||||
impersonate: ImpersonateOutput;
|
||||
publishServerlessFunction: ServerlessFunction;
|
||||
@ -607,7 +609,6 @@ export type Mutation = {
|
||||
uploadProfilePicture: Scalars['String'];
|
||||
uploadWorkspaceLogo: Scalars['String'];
|
||||
userLookupAdminPanel: UserLookup;
|
||||
verify: AuthTokens;
|
||||
};
|
||||
|
||||
|
||||
@ -628,13 +629,6 @@ export type MutationAuthorizeAppArgs = {
|
||||
};
|
||||
|
||||
|
||||
export type MutationChallengeArgs = {
|
||||
captchaToken?: InputMaybe<Scalars['String']>;
|
||||
email: Scalars['String'];
|
||||
password: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
export type MutationCheckoutSessionArgs = {
|
||||
plan?: BillingPlanKey;
|
||||
recurringInterval: SubscriptionInterval;
|
||||
@ -734,11 +728,23 @@ export type MutationGenerateApiKeyTokenArgs = {
|
||||
};
|
||||
|
||||
|
||||
export type MutationGetAuthTokensFromLoginTokenArgs = {
|
||||
loginToken: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
export type MutationGetAuthorizationUrlArgs = {
|
||||
input: GetAuthorizationUrlInput;
|
||||
};
|
||||
|
||||
|
||||
export type MutationGetLoginTokenFromCredentialsArgs = {
|
||||
captchaToken?: InputMaybe<Scalars['String']>;
|
||||
email: Scalars['String'];
|
||||
password: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
export type MutationGetLoginTokenFromEmailVerificationTokenArgs = {
|
||||
captchaToken?: InputMaybe<Scalars['String']>;
|
||||
emailVerificationToken: Scalars['String'];
|
||||
@ -866,11 +872,6 @@ export type MutationUserLookupAdminPanelArgs = {
|
||||
userIdentifier: Scalars['String'];
|
||||
};
|
||||
|
||||
|
||||
export type MutationVerifyArgs = {
|
||||
loginToken: Scalars['String'];
|
||||
};
|
||||
|
||||
export type ObjectConnection = {
|
||||
__typename?: 'ObjectConnection';
|
||||
/** Array of edges. */
|
||||
@ -1070,6 +1071,15 @@ export type QueryValidatePasswordResetTokenArgs = {
|
||||
passwordResetToken: Scalars['String'];
|
||||
};
|
||||
|
||||
export type Relation = {
|
||||
__typename?: 'Relation';
|
||||
sourceFieldMetadata: Field;
|
||||
sourceObjectMetadata: Object;
|
||||
targetFieldMetadata: Field;
|
||||
targetObjectMetadata: Object;
|
||||
type: RelationType;
|
||||
};
|
||||
|
||||
export type RelationConnection = {
|
||||
__typename?: 'RelationConnection';
|
||||
/** Array of edges. */
|
||||
@ -1104,6 +1114,13 @@ export enum RelationMetadataType {
|
||||
ONE_TO_ONE = 'ONE_TO_ONE'
|
||||
}
|
||||
|
||||
/** Relation type */
|
||||
export enum RelationType {
|
||||
MANY_TO_ONE = 'MANY_TO_ONE',
|
||||
ONE_TO_MANY = 'ONE_TO_MANY',
|
||||
ONE_TO_ONE = 'ONE_TO_ONE'
|
||||
}
|
||||
|
||||
export type RemoteServer = {
|
||||
__typename?: 'RemoteServer';
|
||||
createdAt: Scalars['DateTime'];
|
||||
@ -1670,6 +1687,7 @@ export type Field = {
|
||||
name: Scalars['String'];
|
||||
object?: Maybe<Object>;
|
||||
options?: Maybe<Scalars['JSON']>;
|
||||
relation?: Maybe<Relation>;
|
||||
relationDefinition?: Maybe<RelationDefinition>;
|
||||
settings?: Maybe<Scalars['JSON']>;
|
||||
toRelationMetadata?: Maybe<Relation>;
|
||||
@ -1813,20 +1831,6 @@ export type ObjectFilter = {
|
||||
or?: InputMaybe<Array<ObjectFilter>>;
|
||||
};
|
||||
|
||||
export type Relation = {
|
||||
__typename?: 'relation';
|
||||
createdAt: Scalars['DateTime'];
|
||||
fromFieldMetadataId: Scalars['String'];
|
||||
fromObjectMetadata: Object;
|
||||
fromObjectMetadataId: Scalars['String'];
|
||||
id: Scalars['UUID'];
|
||||
relationType: RelationMetadataType;
|
||||
toFieldMetadataId: Scalars['String'];
|
||||
toObjectMetadata: Object;
|
||||
toObjectMetadataId: Scalars['String'];
|
||||
updatedAt: Scalars['DateTime'];
|
||||
};
|
||||
|
||||
export type RelationEdge = {
|
||||
__typename?: 'relationEdge';
|
||||
/** Cursor for this node. */
|
||||
@ -1922,15 +1926,6 @@ export type AuthorizeAppMutationVariables = Exact<{
|
||||
|
||||
export type AuthorizeAppMutation = { __typename?: 'Mutation', authorizeApp: { __typename?: 'AuthorizeApp', redirectUrl: string } };
|
||||
|
||||
export type ChallengeMutationVariables = Exact<{
|
||||
email: Scalars['String'];
|
||||
password: Scalars['String'];
|
||||
captchaToken?: InputMaybe<Scalars['String']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type ChallengeMutation = { __typename?: 'Mutation', challenge: { __typename?: 'LoginToken', loginToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } };
|
||||
|
||||
export type EmailPasswordResetLinkMutationVariables = Exact<{
|
||||
email: Scalars['String'];
|
||||
}>;
|
||||
@ -1951,6 +1946,13 @@ export type GenerateTransientTokenMutationVariables = Exact<{ [key: string]: nev
|
||||
|
||||
export type GenerateTransientTokenMutation = { __typename?: 'Mutation', generateTransientToken: { __typename?: 'TransientToken', transientToken: { __typename?: 'AuthToken', token: string } } };
|
||||
|
||||
export type GetAuthTokensFromLoginTokenMutationVariables = Exact<{
|
||||
loginToken: Scalars['String'];
|
||||
}>;
|
||||
|
||||
|
||||
export type GetAuthTokensFromLoginTokenMutation = { __typename?: 'Mutation', getAuthTokensFromLoginToken: { __typename?: 'AuthTokens', tokens: { __typename?: 'AuthTokenPair', accessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, refreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } } };
|
||||
|
||||
export type GetAuthorizationUrlMutationVariables = Exact<{
|
||||
input: GetAuthorizationUrlInput;
|
||||
}>;
|
||||
@ -1958,6 +1960,15 @@ export type GetAuthorizationUrlMutationVariables = Exact<{
|
||||
|
||||
export type GetAuthorizationUrlMutation = { __typename?: 'Mutation', getAuthorizationUrl: { __typename?: 'GetAuthorizationUrlOutput', id: string, type: string, authorizationURL: string } };
|
||||
|
||||
export type GetLoginTokenFromCredentialsMutationVariables = Exact<{
|
||||
email: Scalars['String'];
|
||||
password: Scalars['String'];
|
||||
captchaToken?: InputMaybe<Scalars['String']>;
|
||||
}>;
|
||||
|
||||
|
||||
export type GetLoginTokenFromCredentialsMutation = { __typename?: 'Mutation', getLoginTokenFromCredentials: { __typename?: 'LoginToken', loginToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } };
|
||||
|
||||
export type GetLoginTokenFromEmailVerificationTokenMutationVariables = Exact<{
|
||||
emailVerificationToken: Scalars['String'];
|
||||
captchaToken?: InputMaybe<Scalars['String']>;
|
||||
@ -2008,13 +2019,6 @@ export type UpdatePasswordViaResetTokenMutationVariables = Exact<{
|
||||
|
||||
export type UpdatePasswordViaResetTokenMutation = { __typename?: 'Mutation', updatePasswordViaResetToken: { __typename?: 'InvalidatePassword', success: boolean } };
|
||||
|
||||
export type VerifyMutationVariables = Exact<{
|
||||
loginToken: Scalars['String'];
|
||||
}>;
|
||||
|
||||
|
||||
export type VerifyMutation = { __typename?: 'Mutation', verify: { __typename?: 'AuthTokens', tokens: { __typename?: 'AuthTokenPair', accessToken: { __typename?: 'AuthToken', token: string, expiresAt: string }, refreshToken: { __typename?: 'AuthToken', token: string, expiresAt: string } } } };
|
||||
|
||||
export type CheckUserExistsQueryVariables = Exact<{
|
||||
email: Scalars['String'];
|
||||
captchaToken?: InputMaybe<Scalars['String']>;
|
||||
@ -2748,43 +2752,6 @@ export function useAuthorizeAppMutation(baseOptions?: Apollo.MutationHookOptions
|
||||
export type AuthorizeAppMutationHookResult = ReturnType<typeof useAuthorizeAppMutation>;
|
||||
export type AuthorizeAppMutationResult = Apollo.MutationResult<AuthorizeAppMutation>;
|
||||
export type AuthorizeAppMutationOptions = Apollo.BaseMutationOptions<AuthorizeAppMutation, AuthorizeAppMutationVariables>;
|
||||
export const ChallengeDocument = gql`
|
||||
mutation Challenge($email: String!, $password: String!, $captchaToken: String) {
|
||||
challenge(email: $email, password: $password, captchaToken: $captchaToken) {
|
||||
loginToken {
|
||||
...AuthTokenFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${AuthTokenFragmentFragmentDoc}`;
|
||||
export type ChallengeMutationFn = Apollo.MutationFunction<ChallengeMutation, ChallengeMutationVariables>;
|
||||
|
||||
/**
|
||||
* __useChallengeMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useChallengeMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `useChallengeMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [challengeMutation, { data, loading, error }] = useChallengeMutation({
|
||||
* variables: {
|
||||
* email: // value for 'email'
|
||||
* password: // value for 'password'
|
||||
* captchaToken: // value for 'captchaToken'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useChallengeMutation(baseOptions?: Apollo.MutationHookOptions<ChallengeMutation, ChallengeMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<ChallengeMutation, ChallengeMutationVariables>(ChallengeDocument, options);
|
||||
}
|
||||
export type ChallengeMutationHookResult = ReturnType<typeof useChallengeMutation>;
|
||||
export type ChallengeMutationResult = Apollo.MutationResult<ChallengeMutation>;
|
||||
export type ChallengeMutationOptions = Apollo.BaseMutationOptions<ChallengeMutation, ChallengeMutationVariables>;
|
||||
export const EmailPasswordResetLinkDocument = gql`
|
||||
mutation EmailPasswordResetLink($email: String!) {
|
||||
emailPasswordResetLink(email: $email) {
|
||||
@ -2886,6 +2853,41 @@ export function useGenerateTransientTokenMutation(baseOptions?: Apollo.MutationH
|
||||
export type GenerateTransientTokenMutationHookResult = ReturnType<typeof useGenerateTransientTokenMutation>;
|
||||
export type GenerateTransientTokenMutationResult = Apollo.MutationResult<GenerateTransientTokenMutation>;
|
||||
export type GenerateTransientTokenMutationOptions = Apollo.BaseMutationOptions<GenerateTransientTokenMutation, GenerateTransientTokenMutationVariables>;
|
||||
export const GetAuthTokensFromLoginTokenDocument = gql`
|
||||
mutation GetAuthTokensFromLoginToken($loginToken: String!) {
|
||||
getAuthTokensFromLoginToken(loginToken: $loginToken) {
|
||||
tokens {
|
||||
...AuthTokensFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${AuthTokensFragmentFragmentDoc}`;
|
||||
export type GetAuthTokensFromLoginTokenMutationFn = Apollo.MutationFunction<GetAuthTokensFromLoginTokenMutation, GetAuthTokensFromLoginTokenMutationVariables>;
|
||||
|
||||
/**
|
||||
* __useGetAuthTokensFromLoginTokenMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useGetAuthTokensFromLoginTokenMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `useGetAuthTokensFromLoginTokenMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [getAuthTokensFromLoginTokenMutation, { data, loading, error }] = useGetAuthTokensFromLoginTokenMutation({
|
||||
* variables: {
|
||||
* loginToken: // value for 'loginToken'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useGetAuthTokensFromLoginTokenMutation(baseOptions?: Apollo.MutationHookOptions<GetAuthTokensFromLoginTokenMutation, GetAuthTokensFromLoginTokenMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<GetAuthTokensFromLoginTokenMutation, GetAuthTokensFromLoginTokenMutationVariables>(GetAuthTokensFromLoginTokenDocument, options);
|
||||
}
|
||||
export type GetAuthTokensFromLoginTokenMutationHookResult = ReturnType<typeof useGetAuthTokensFromLoginTokenMutation>;
|
||||
export type GetAuthTokensFromLoginTokenMutationResult = Apollo.MutationResult<GetAuthTokensFromLoginTokenMutation>;
|
||||
export type GetAuthTokensFromLoginTokenMutationOptions = Apollo.BaseMutationOptions<GetAuthTokensFromLoginTokenMutation, GetAuthTokensFromLoginTokenMutationVariables>;
|
||||
export const GetAuthorizationUrlDocument = gql`
|
||||
mutation GetAuthorizationUrl($input: GetAuthorizationUrlInput!) {
|
||||
getAuthorizationUrl(input: $input) {
|
||||
@ -2921,6 +2923,47 @@ export function useGetAuthorizationUrlMutation(baseOptions?: Apollo.MutationHook
|
||||
export type GetAuthorizationUrlMutationHookResult = ReturnType<typeof useGetAuthorizationUrlMutation>;
|
||||
export type GetAuthorizationUrlMutationResult = Apollo.MutationResult<GetAuthorizationUrlMutation>;
|
||||
export type GetAuthorizationUrlMutationOptions = Apollo.BaseMutationOptions<GetAuthorizationUrlMutation, GetAuthorizationUrlMutationVariables>;
|
||||
export const GetLoginTokenFromCredentialsDocument = gql`
|
||||
mutation GetLoginTokenFromCredentials($email: String!, $password: String!, $captchaToken: String) {
|
||||
getLoginTokenFromCredentials(
|
||||
email: $email
|
||||
password: $password
|
||||
captchaToken: $captchaToken
|
||||
) {
|
||||
loginToken {
|
||||
...AuthTokenFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${AuthTokenFragmentFragmentDoc}`;
|
||||
export type GetLoginTokenFromCredentialsMutationFn = Apollo.MutationFunction<GetLoginTokenFromCredentialsMutation, GetLoginTokenFromCredentialsMutationVariables>;
|
||||
|
||||
/**
|
||||
* __useGetLoginTokenFromCredentialsMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useGetLoginTokenFromCredentialsMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `useGetLoginTokenFromCredentialsMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [getLoginTokenFromCredentialsMutation, { data, loading, error }] = useGetLoginTokenFromCredentialsMutation({
|
||||
* variables: {
|
||||
* email: // value for 'email'
|
||||
* password: // value for 'password'
|
||||
* captchaToken: // value for 'captchaToken'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useGetLoginTokenFromCredentialsMutation(baseOptions?: Apollo.MutationHookOptions<GetLoginTokenFromCredentialsMutation, GetLoginTokenFromCredentialsMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<GetLoginTokenFromCredentialsMutation, GetLoginTokenFromCredentialsMutationVariables>(GetLoginTokenFromCredentialsDocument, options);
|
||||
}
|
||||
export type GetLoginTokenFromCredentialsMutationHookResult = ReturnType<typeof useGetLoginTokenFromCredentialsMutation>;
|
||||
export type GetLoginTokenFromCredentialsMutationResult = Apollo.MutationResult<GetLoginTokenFromCredentialsMutation>;
|
||||
export type GetLoginTokenFromCredentialsMutationOptions = Apollo.BaseMutationOptions<GetLoginTokenFromCredentialsMutation, GetLoginTokenFromCredentialsMutationVariables>;
|
||||
export const GetLoginTokenFromEmailVerificationTokenDocument = gql`
|
||||
mutation GetLoginTokenFromEmailVerificationToken($emailVerificationToken: String!, $captchaToken: String) {
|
||||
getLoginTokenFromEmailVerificationToken(
|
||||
@ -3156,41 +3199,6 @@ export function useUpdatePasswordViaResetTokenMutation(baseOptions?: Apollo.Muta
|
||||
export type UpdatePasswordViaResetTokenMutationHookResult = ReturnType<typeof useUpdatePasswordViaResetTokenMutation>;
|
||||
export type UpdatePasswordViaResetTokenMutationResult = Apollo.MutationResult<UpdatePasswordViaResetTokenMutation>;
|
||||
export type UpdatePasswordViaResetTokenMutationOptions = Apollo.BaseMutationOptions<UpdatePasswordViaResetTokenMutation, UpdatePasswordViaResetTokenMutationVariables>;
|
||||
export const VerifyDocument = gql`
|
||||
mutation Verify($loginToken: String!) {
|
||||
verify(loginToken: $loginToken) {
|
||||
tokens {
|
||||
...AuthTokensFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${AuthTokensFragmentFragmentDoc}`;
|
||||
export type VerifyMutationFn = Apollo.MutationFunction<VerifyMutation, VerifyMutationVariables>;
|
||||
|
||||
/**
|
||||
* __useVerifyMutation__
|
||||
*
|
||||
* To run a mutation, you first call `useVerifyMutation` within a React component and pass it any options that fit your needs.
|
||||
* When your component renders, `useVerifyMutation` returns a tuple that includes:
|
||||
* - A mutate function that you can call at any time to execute the mutation
|
||||
* - An object with fields that represent the current status of the mutation's execution
|
||||
*
|
||||
* @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;
|
||||
*
|
||||
* @example
|
||||
* const [verifyMutation, { data, loading, error }] = useVerifyMutation({
|
||||
* variables: {
|
||||
* loginToken: // value for 'loginToken'
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export function useVerifyMutation(baseOptions?: Apollo.MutationHookOptions<VerifyMutation, VerifyMutationVariables>) {
|
||||
const options = {...defaultOptions, ...baseOptions}
|
||||
return Apollo.useMutation<VerifyMutation, VerifyMutationVariables>(VerifyDocument, options);
|
||||
}
|
||||
export type VerifyMutationHookResult = ReturnType<typeof useVerifyMutation>;
|
||||
export type VerifyMutationResult = Apollo.MutationResult<VerifyMutation>;
|
||||
export type VerifyMutationOptions = Apollo.BaseMutationOptions<VerifyMutation, VerifyMutationVariables>;
|
||||
export const CheckUserExistsDocument = gql`
|
||||
query CheckUserExists($email: String!, $captchaToken: String) {
|
||||
checkUserExists(email: $email, captchaToken: $captchaToken) {
|
||||
|
||||
Reference in New Issue
Block a user