UNPKG

@shopify/shopify-app-remix

Version:

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

32 lines (27 loc) 877 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var shopifyApi = require('@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 shopifyApi.InvalidJwtError || (error instanceof shopifyApi.HttpResponseError && error.response.code === 400 && error.response.body?.error === 'invalid_subject_token')) { throw error; } throw new Response(undefined, { status: 500, statusText: 'Internal Server Error', }); } } exports.default = refreshToken; //# sourceMappingURL=refresh-token.js.map