Fix refresh token

This commit is contained in:
dominik-zeglen 2020-07-01 13:11:08 +02:00
parent e7a0495556
commit 7e11db8c52
4 changed files with 51 additions and 24 deletions

View file

@ -62,6 +62,11 @@ enum AccountErrorCode {
PASSWORD_TOO_SIMILAR PASSWORD_TOO_SIMILAR
REQUIRED REQUIRED
UNIQUE UNIQUE
JWT_SIGNATURE_EXPIRED
JWT_INVALID_TOKEN
JWT_DECODE_ERROR
JWT_MISSING_TOKEN
JWT_INVALID_CSRF_TOKEN
} }
input AccountInput { input AccountInput {
@ -1443,10 +1448,12 @@ type CountryDisplay {
} }
type CreateToken { type CreateToken {
token: String
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
accountErrors: [AccountError!]! token: String
refreshToken: String
csrfToken: String
user: User user: User
accountErrors: [AccountError!]!
} }
type CreditCard { type CreditCard {
@ -1540,6 +1547,11 @@ input DateTimeRangeInput {
lte: DateTime lte: DateTime
} }
type DeactivateAllUserTokens {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
accountErrors: [AccountError!]!
}
scalar Decimal scalar Decimal
type DeleteMetadata { type DeleteMetadata {
@ -2449,9 +2461,6 @@ type Mutation {
voucherCataloguesAdd(id: ID!, input: CatalogueInput!): VoucherAddCatalogues voucherCataloguesAdd(id: ID!, input: CatalogueInput!): VoucherAddCatalogues
voucherCataloguesRemove(id: ID!, input: CatalogueInput!): VoucherRemoveCatalogues voucherCataloguesRemove(id: ID!, input: CatalogueInput!): VoucherRemoveCatalogues
voucherTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): VoucherTranslate voucherTranslate(id: ID!, input: NameTranslationInput!, languageCode: LanguageCodeEnum!): VoucherTranslate
tokenCreate(email: String!, password: String!): CreateToken
tokenRefresh(token: String!): RefreshToken
tokenVerify(token: String!): VerifyToken
checkoutAddPromoCode(checkoutId: ID!, promoCode: String!): CheckoutAddPromoCode checkoutAddPromoCode(checkoutId: ID!, promoCode: String!): CheckoutAddPromoCode
checkoutBillingAddressUpdate(billingAddress: AddressInput!, checkoutId: ID!): CheckoutBillingAddressUpdate checkoutBillingAddressUpdate(billingAddress: AddressInput!, checkoutId: ID!): CheckoutBillingAddressUpdate
checkoutComplete(checkoutId: ID!, redirectUrl: String, storeSource: Boolean = false): CheckoutComplete checkoutComplete(checkoutId: ID!, redirectUrl: String, storeSource: Boolean = false): CheckoutComplete
@ -2476,9 +2485,13 @@ type Mutation {
appTokenCreate(input: AppTokenInput!): AppTokenCreate appTokenCreate(input: AppTokenInput!): AppTokenCreate
appTokenDelete(id: ID!): AppTokenDelete appTokenDelete(id: ID!): AppTokenDelete
appTokenVerify(token: String!): AppTokenVerify appTokenVerify(token: String!): AppTokenVerify
tokenCreate(email: String!, password: String!): CreateToken
tokenRefresh(csrfToken: String, refreshToken: String): RefreshToken
tokenVerify(token: String!): VerifyToken
tokensDeactivateAll: DeactivateAllUserTokens
requestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset requestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset
confirmAccount(email: String!, token: String!): ConfirmAccount confirmAccount(email: String!, token: String!): ConfirmAccount
setPassword(token: String!, email: String!, password: String!): SetPassword setPassword(email: String!, password: String!, token: String!): SetPassword
passwordChange(newPassword: String!, oldPassword: String!): PasswordChange passwordChange(newPassword: String!, oldPassword: String!): PasswordChange
requestEmailChange(newEmail: String!, password: String!, redirectUrl: String!): RequestEmailChange requestEmailChange(newEmail: String!, password: String!, redirectUrl: String!): RequestEmailChange
confirmEmailChange(token: String!): ConfirmEmailChange confirmEmailChange(token: String!): ConfirmEmailChange
@ -2753,6 +2766,7 @@ enum OrderEventsEnum {
ORDER_FULLY_PAID ORDER_FULLY_PAID
UPDATED_ADDRESS UPDATED_ADDRESS
EMAIL_SENT EMAIL_SENT
PAYMENT_AUTHORIZED
PAYMENT_CAPTURED PAYMENT_CAPTURED
PAYMENT_REFUNDED PAYMENT_REFUNDED
PAYMENT_VOIDED PAYMENT_VOIDED
@ -3105,19 +3119,21 @@ enum PaymentErrorCode {
GRAPHQL_ERROR GRAPHQL_ERROR
INVALID INVALID
NOT_FOUND NOT_FOUND
REQUIRED
UNIQUE
PARTIAL_PAYMENT_NOT_ALLOWED PARTIAL_PAYMENT_NOT_ALLOWED
SHIPPING_ADDRESS_NOT_SET SHIPPING_ADDRESS_NOT_SET
INVALID_SHIPPING_METHOD INVALID_SHIPPING_METHOD
SHIPPING_METHOD_NOT_SET SHIPPING_METHOD_NOT_SET
PAYMENT_ERROR PAYMENT_ERROR
REQUIRED NOT_SUPPORTED_GATEWAY
UNIQUE
} }
type PaymentGateway { type PaymentGateway {
name: String! name: String!
id: ID! id: ID!
config: [GatewayConfigLine!]! config: [GatewayConfigLine!]!
currencies: [String]!
} }
input PaymentInput { input PaymentInput {
@ -3176,8 +3192,8 @@ enum PermissionEnum {
type PermissionGroupCreate { type PermissionGroupCreate {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
group: Group
permissionGroupErrors: [PermissionGroupError!]! permissionGroupErrors: [PermissionGroupError!]!
group: Group
} }
input PermissionGroupCreateInput { input PermissionGroupCreateInput {
@ -3226,8 +3242,8 @@ input PermissionGroupSortingInput {
type PermissionGroupUpdate { type PermissionGroupUpdate {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
group: Group
permissionGroupErrors: [PermissionGroupError!]! permissionGroupErrors: [PermissionGroupError!]!
group: Group
} }
input PermissionGroupUpdateInput { input PermissionGroupUpdateInput {
@ -3958,8 +3974,10 @@ type ReducedRate {
} }
type RefreshToken { type RefreshToken {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
token: String token: String
payload: GenericScalar user: User
accountErrors: [AccountError!]!
} }
input ReorderInput { input ReorderInput {
@ -4209,10 +4227,12 @@ type ServiceAccountUpdatePrivateMeta {
} }
type SetPassword { type SetPassword {
token: String
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
accountErrors: [AccountError!]! token: String
refreshToken: String
csrfToken: String
user: User user: User
accountErrors: [AccountError!]!
} }
type ShippingError { type ShippingError {
@ -4336,8 +4356,8 @@ type ShippingZoneCountableEdge {
type ShippingZoneCreate { type ShippingZoneCreate {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
shippingZone: ShippingZone
shippingErrors: [ShippingError!]! shippingErrors: [ShippingError!]!
shippingZone: ShippingZone
} }
input ShippingZoneCreateInput { input ShippingZoneCreateInput {
@ -4355,8 +4375,8 @@ type ShippingZoneDelete {
type ShippingZoneUpdate { type ShippingZoneUpdate {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
shippingZone: ShippingZone
shippingErrors: [ShippingError!]! shippingErrors: [ShippingError!]!
shippingZone: ShippingZone
} }
input ShippingZoneUpdateInput { input ShippingZoneUpdateInput {
@ -4368,7 +4388,7 @@ input ShippingZoneUpdateInput {
} }
type Shop { type Shop {
availablePaymentGateways: [PaymentGateway!]! availablePaymentGateways(currency: String): [PaymentGateway!]!
geolocalization: Geolocalization geolocalization: Geolocalization
authorizationKeys: [AuthorizationKey]! authorizationKeys: [AuthorizationKey]!
countries(languageCode: LanguageCodeEnum): [CountryDisplay!]! countries(languageCode: LanguageCodeEnum): [CountryDisplay!]!
@ -4904,8 +4924,11 @@ type VariantPricingInfo {
} }
type VerifyToken { type VerifyToken {
payload: GenericScalar errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
user: User user: User
isValid: Boolean!
payload: GenericScalar
accountErrors: [AccountError!]!
} }
type Voucher implements Node { type Voucher implements Node {
@ -5125,14 +5148,14 @@ input WarehouseFilterInput {
type WarehouseShippingZoneAssign { type WarehouseShippingZoneAssign {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
warehouse: Warehouse
warehouseErrors: [WarehouseError!]! warehouseErrors: [WarehouseError!]!
warehouse: Warehouse
} }
type WarehouseShippingZoneUnassign { type WarehouseShippingZoneUnassign {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
warehouse: Warehouse
warehouseErrors: [WarehouseError!]! warehouseErrors: [WarehouseError!]!
warehouse: Warehouse
} }
enum WarehouseSortField { enum WarehouseSortField {
@ -5198,8 +5221,8 @@ input WebhookCreateInput {
type WebhookDelete { type WebhookDelete {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
webhook: Webhook
webhookErrors: [WebhookError!]! webhookErrors: [WebhookError!]!
webhook: Webhook
} }
type WebhookError { type WebhookError {
@ -5265,8 +5288,8 @@ input WebhookSortingInput {
type WebhookUpdate { type WebhookUpdate {
errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.") errors: [Error!]! @deprecated(reason: "Use typed errors with error codes. This field will be removed after 2020-07-31.")
webhook: Webhook
webhookErrors: [WebhookError!]! webhookErrors: [WebhookError!]!
webhook: Webhook
} }
input WebhookUpdateInput { input WebhookUpdateInput {

View file

@ -102,9 +102,8 @@ export const SetPasswordMutation = TypedMutation<
const refreshToken = gql` const refreshToken = gql`
mutation RefreshToken($token: String!) { mutation RefreshToken($token: String!) {
tokenRefresh(token: $token) { tokenRefresh(csrfToken: $token) {
token token
payload
} }
} }
`; `;

View file

@ -9,7 +9,6 @@
export interface RefreshToken_tokenRefresh { export interface RefreshToken_tokenRefresh {
__typename: "RefreshToken"; __typename: "RefreshToken";
token: string | null; token: string | null;
payload: any | null;
} }
export interface RefreshToken { export interface RefreshToken {

View file

@ -20,6 +20,11 @@ export enum AccountErrorCode {
INVALID = "INVALID", INVALID = "INVALID",
INVALID_CREDENTIALS = "INVALID_CREDENTIALS", INVALID_CREDENTIALS = "INVALID_CREDENTIALS",
INVALID_PASSWORD = "INVALID_PASSWORD", INVALID_PASSWORD = "INVALID_PASSWORD",
JWT_DECODE_ERROR = "JWT_DECODE_ERROR",
JWT_INVALID_CSRF_TOKEN = "JWT_INVALID_CSRF_TOKEN",
JWT_INVALID_TOKEN = "JWT_INVALID_TOKEN",
JWT_MISSING_TOKEN = "JWT_MISSING_TOKEN",
JWT_SIGNATURE_EXPIRED = "JWT_SIGNATURE_EXPIRED",
LEFT_NOT_MANAGEABLE_PERMISSION = "LEFT_NOT_MANAGEABLE_PERMISSION", LEFT_NOT_MANAGEABLE_PERMISSION = "LEFT_NOT_MANAGEABLE_PERMISSION",
NOT_FOUND = "NOT_FOUND", NOT_FOUND = "NOT_FOUND",
OUT_OF_SCOPE_GROUP = "OUT_OF_SCOPE_GROUP", OUT_OF_SCOPE_GROUP = "OUT_OF_SCOPE_GROUP",
@ -502,6 +507,7 @@ export enum OrderEventsEnum {
ORDER_MARKED_AS_PAID = "ORDER_MARKED_AS_PAID", ORDER_MARKED_AS_PAID = "ORDER_MARKED_AS_PAID",
OTHER = "OTHER", OTHER = "OTHER",
OVERSOLD_ITEMS = "OVERSOLD_ITEMS", OVERSOLD_ITEMS = "OVERSOLD_ITEMS",
PAYMENT_AUTHORIZED = "PAYMENT_AUTHORIZED",
PAYMENT_CAPTURED = "PAYMENT_CAPTURED", PAYMENT_CAPTURED = "PAYMENT_CAPTURED",
PAYMENT_FAILED = "PAYMENT_FAILED", PAYMENT_FAILED = "PAYMENT_FAILED",
PAYMENT_REFUNDED = "PAYMENT_REFUNDED", PAYMENT_REFUNDED = "PAYMENT_REFUNDED",