Skip to content
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

Feature to extract token #17

Open
sdwru opened this issue Mar 9, 2021 · 2 comments
Open

Feature to extract token #17

sdwru opened this issue Mar 9, 2021 · 2 comments

Comments

@sdwru
Copy link

sdwru commented Mar 9, 2021

I would like to use this for managing oauth2 tokens in the background. I would like to use the following project for graphql client.
https://github.com/mghoneimy/php-graphql-client

I can't do that without modifying this middleware to extract the token and insert it into the other projects guzzle wrapper. I had a look at your graphql-client project. It is using raw GraphQL queries. I need something that can dynamically generate the queries in PHP and that is what that other project does. However, that other project doesn't include any built in support for Oauth2.

@sdwru sdwru changed the title Feature to extract Token Feature to extract token Mar 9, 2021
@rccrdpccl
Copy link
Contributor

It is not clear to me how are you planning to use it, if you cannot inject it in the other client you mention.

Could you please elaborate how would you like to use this middleware?

@sdwru
Copy link
Author

sdwru commented Mar 9, 2021

This is how I configure their Client.

$client = new Client(
    'http://someurl.com/api/gql',
    ['Authorization' => 'Bearer ' . $token]
);

Where $client is their guzzle wrapper.

I need to provide the oauth2 $token in that wrapper, including the automatic renewal when it expires. It is easy enough to do that myself but I would rather use a package such as yours so I don't have to. The problem with your package is you do not explicitly expose the token. That is all kept in the background as middleware. You just expose the guzzle client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants