UNPKG

@shopify/shopify-app-remix

Version:

Shopify Remix - to simplify the building of Shopify Apps with Remix

28 lines (25 loc) 806 B
import { InvalidJwtError, HttpResponseError } from '@shopify/shopify-api'; async function refreshToken(params, shop, refreshToken) { const { api } = params; try { const { session } = await api.auth.refreshToken({ shop, refreshToken, }); return session; } catch (error) { if (error instanceof InvalidJwtError || (error instanceof HttpResponseError && error.response.code === 400 && error.response.body?.error === 'invalid_subject_token')) { throw error; } throw new Response(undefined, { status: 500, statusText: 'Internal Server Error', }); } } export { refreshToken as default }; //# sourceMappingURL=refresh-token.mjs.map