-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to use this with GraphQL requests? #123
Comments
Hi @spsaucier-bakkt i am not familiar with GraphQL, i don't think this library can be used with it. |
It can be used, just specify the fetch option on your http link |
Thank you @dacevedo12 for the reply. Thanks! |
Sure import { fetch as sslPinningFetch } from "react-native-ssl-pinning";
const secureFetch = async (uri, options) =>
sslPinningFetch(uri, {
...options,
pkPinning: true,
sslPinning: {
certs: ["sha256/your_cert_goes_here"],
},
});
const httpLink = createHttpLink({
fetch: secureFetch,
uri: `https://www.something.com/api`,
}); You can learn more about using a custom fetch at the official docs https://www.apollographql.com/docs/react/api/link/apollo-link-http/#customizing-fetch |
It is giving me an error for fetch: secureFetch type mismatch.
|
@jigneshpatel-dreampay It's been almost a year, so it's very likely the type definitions have changed 😅 I'm no longer working on react native apps, but it can probably be adapted based on the snippet. It's a matter of creating a way for apollo's fetch to interact with ssl-pinning's fetch function |
Hello, do you have a working example? |
We're using
@apollo/client
for most requests from the back-end, so we aren't able to use thefetch
methods in the documentation. Is there a way to enable SSL pinning requirements on GraphQL requests?The text was updated successfully, but these errors were encountered: