Skip to main content
Version: 0.1.x

Authentication

SALVO-TS provides some functions to help you manage customer authentication in Shopify. These are available on the Auth singleton object.

You can access Auth in components or pages via this.auth. If you need to use it from elsewhere, import the Theme instance and access it it there:

typescript
// Inside component
await this.auth.logout();
// Inside page
await this.auth.logout();
// Inside other file
import theme from '@/theme';
await theme.auth.logout();
typescript
// Inside component
await this.auth.logout();
// Inside page
await this.auth.logout();
// Inside other file
import theme from '@/theme';
await theme.auth.logout();

After the customer has logged in, you can access their details via auth.customer - see the Customer documentation for more information.

Standard Shopify Auth

Login

Logout

External Auth via Multipass

For Shopify Plus projects which involve an ESC-Shopify Multipass Integration, SALVO-TS provides some simple helper functions for communicating with the auth service.

Hosted Login

typescript
// This will perform a redirect to the auth service, then
// return the user to the specified URL.
this.auth.multipass.hostedLogin({
service: 'https://example.eastsidecoapps.io/',
redirect: window.location.href,
});
typescript
// This will perform a redirect to the auth service, then
// return the user to the specified URL.
this.auth.multipass.hostedLogin({
service: 'https://example.eastsidecoapps.io/',
redirect: window.location.href,
});

Inline Login

If the project supports it, you can login via Multipass directly.

typescript
await this.auth.multipass.inlineLogin({
// exact options will depend on the Multipass integration
email: 'foo@example.com',
password: 'password123',
});
typescript
await this.auth.multipass.inlineLogin({
// exact options will depend on the Multipass integration
email: 'foo@example.com',
password: 'password123',
});

Logout