Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
@8base/apollo-links
Advanced tools
A collection of Apollo links for more efficient communication with the 8base API.
A collection of Apollo links for more efficient communication with the 8base API.
Extends ApolloLink
Token Refresh Link renew authentication token when it's expired.
options
TokenRefreshLinkOptions The token refresh link options.
SuccessLink calls handler on every successful operation.
successHandler
Function success handler.Success handler takes the following parameters:
operation
Operation apollo graphql operation.import { ApolloLink } from 'apollo-link';
import { BatchHttpLink } from 'apollo-link-batch-http';
import { getMainDefinition } from 'apollo-utilities';
import {
AuthLink,
FileUploadLink,
SuccessLink,
} from '@8base/apollo-links';
const successHandler = ({ operation }) => {
console.log(operation.getContext().someUsefulData);
};
const getAuthState = () => ({
workspaceId: '',
email: '',
token: '',
});
const getRefreshTokenParameters = () => ({
email: '',
refreshToken: '',
});
const authSuccessHandler = ({ token, refreshToken}) => {
console.log({ token, refreshToken });
}
const authErrorHandler = () => {
console.log('Auth error');
}
const links = ApolloLink.from([
new FileUploadLink(),
new SuccessLink(successHandler),
new AuthLink({
getAuthState: getAuthState,
getRefreshTokenParameters: getRefreshTokenParameters,
onAuthSuccess: authSuccessHandler,
onAuthError: authErrorHandler,
}),
ApolloLink.split(
({ query }) => {
const definition = getMainDefinition(query);
return (
definition.kind === 'OperationDefinition' &&
definition.operation === 'subscription'
);
},
new SubscriptionLink({
uri: 'wss://api-ws.8base.com',
getAuthState: getAuthState,
onAuthError: authErrorHandler,
}),
new BatchHttpLink({
uri: 'https://api.8base.com',
}),
),
])
FAQs
A collection of Apollo links for more efficient communication with the 8base API.
We found that @8base/apollo-links demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.