![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
apollo-link-opaque-refresh
Advanced tools
npm i apollo-link-opaque-refresh
Apollo Link to handle expired tokens (both JWT and opaque tokens) on auth-expired requests.
This link operates bi-directionally. When a query responds with an error, a handler is triggered to determine whether that response conforms to a "token expired" error.
If the request is deemed to be a token expiry, the query will be queued for re-attempt, and the token refresh handler will be started.
While the token is being refreshed, all requests attempted will be paused and queued before hitting terminating link. Once the token refresh is finished (either successful refresh or failure to refresh) the queue will be processed and all requests will be resumed.
This link does not check the token before sending queries. It operates on responses, therefore allowing a silent refresh mechanism for all types of tokens. It will pause outgoing queries if an active refresh is present. This is useful if your token expiry offset is unreliable on client or your tokens are using a proprietary format.
If you want to refresh and queue your queries prior to making a failing request, try newsiberian/apollo-link-token-refresh
tokenRefreshLink({
refreshToken: async () => {
try {
await performSomeTokenRefresh();
} catch (error) {
userSignOut();
throw error;
}
},
shouldRefresh: ({ operation, result, networkError }) => {
return networkError?.statusCode === 401;
},
})
The link takes a single options
object with the following required properties:
property | description | |
---|---|---|
refreshToken | () => Promise | Implements your token refresh mechanism. Throw an error if unable to refresh. Successful resolve implies token was refreshed and is available to further links. |
shouldRefresh | ({ operation, result, networkError }) => boolean | Using the provided values should determine whether the response warrants a token refresh. |
FAQs
Apollo Link for token refresh of JWT or Opaque tokens
The npm package apollo-link-opaque-refresh receives a total of 262 weekly downloads. As such, apollo-link-opaque-refresh popularity was classified as not popular.
We found that apollo-link-opaque-refresh demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.