Code Monkey home page Code Monkey logo

Comments (11)

marwfair avatar marwfair commented on May 18, 2024 2

@HofmannZ Not sure where else to put this, but how would you create a custom Link that would listen for the responses and chain a request if needed? So if I try to make a mutation but my authentication token is expired, how can I check the graphql response for the authentication error, refresh my token, then retry my mutation?

from graphql-flutter.

HofmannZ avatar HofmannZ commented on May 18, 2024 1

Fix is in PR #36

from graphql-flutter.

vmwsree avatar vmwsree commented on May 18, 2024

Or something like

Authorization: <type> <credentials>

from graphql-flutter.

endigo avatar endigo commented on May 18, 2024

@HofmannZ any progress?

from graphql-flutter.

jeprojects avatar jeprojects commented on May 18, 2024

@HofmannZ Looking forward to PR #36 as I too need to have more control over the headers for AWS AppSync.

I am testing out your link-1 branch, is that working for the http-link? I am accessing the GraphQL client outside of a widget.

If so, could you post some basic example code? I have tried to pass in the HttpLink object to the GraphqlClient, but get an error when trying to create the HttpLink object "type 'Link' is not a subtype of type 'HttpLink'" So I suspect I am doing something wrong.

from graphql-flutter.

HofmannZ avatar HofmannZ commented on May 18, 2024

@vmwsree, @endigo & @jeprojects fixed in #36.

To try it out use version 1.0.0-alpha.3 of this package.

from graphql-flutter.

idkjs avatar idkjs commented on May 18, 2024

@HofmannZ I'm trying appsync integration. Did you get that to work? If so, can you post how you passed auth to the client? Thank you.

from graphql-flutter.

Gitutsav avatar Gitutsav commented on May 18, 2024

how can I add authentication header in graphql-client api??

from graphql-flutter.

wwwdata avatar wwwdata commented on May 18, 2024

@Gitutsav it is actually quite easy and flexible. You could set your own http/Client implementation into the HttpLink constructor fetch parameter.

For our project I implemented bearer authentication with token refreshment in this client. You can intercept all the requests and modify them, add headers, query parameters, all you need.

But if you only need to set headers, just using them directly in the HttpLink constructor is enough.

https://pub.dartlang.org/documentation/graphql_flutter/1.0.0-beta.1+1/graphql_flutter/HttpLink-class.html

from graphql-flutter.

HofmannZ avatar HofmannZ commented on May 18, 2024

@Gitutsav I think the easiest way would be to use the auth link or create a custom auth link.

@wwwdata I think it would be way easier to create your own link see #173.

from graphql-flutter.

Gitutsav avatar Gitutsav commented on May 18, 2024

from graphql-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.