package graphql import ( "context" "github.com/gshopify/service-wrapper/auth" "gshopper.com/gshopify/customer/graphql/generated" "gshopper.com/gshopify/customer/model" ) func (r *mutationResolver) CustomerAccessTokenDelete( ctx context.Context, t string) (*generated.CustomerAccessTokenDeletePayload, error) { var ( response = &generated.CustomerAccessTokenDeletePayload{} session = auth.SessionManager() claims *model.Claims err error ) _, claims, err = r.decodeAccessToken(ctx, t) if err != nil { response.UserErrors = append(response.UserErrors, ErrToken(err.Error())) return response, nil } _ = session.DeleteToken(ctx, claims.SessionId) admin, err := r.conf.Admin.Token(r.client, ctx) if err != nil { response.UserErrors = append(response.UserErrors, ErrToken(err.Error())) return response, nil } if err = r.client.LogoutUserSession(ctx, admin.AccessToken, r.conf.Cli.Realm, claims.SessionId); err != nil { response.UserErrors = append(response.UserErrors, ErrToken(err.Error())) return response, nil } response.DeletedAccessToken = &t response.DeletedCustomerAccessTokenID = &claims.SessionId return response, nil }