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

get_bearer_token and refresh should return the parsed JSON response. #15

Open
dreid opened this issue Oct 29, 2019 · 4 comments
Open

get_bearer_token and refresh should return the parsed JSON response. #15

dreid opened this issue Oct 29, 2019 · 4 comments

Comments

@dreid
Copy link

dreid commented Oct 29, 2019

Currently these only set the values in the json response as attributes of the AuthClient this makes it difficult to know which attributes will be available when, for instance, get_bearer_token sets realm_id but refresh doesn't.

We want results of talking to AuthClient to be able to participate in our strict runtime type checking which involves converting a primitive python type into an attrs dataclass. Having to construct this dictionary out of the AuthClient before we can do that is annoying and error prone.

@dreid dreid changed the title get_bearer_token and refresh_token should return the parsed JSON response. get_bearer_token and refresh should return the parsed JSON response. Oct 29, 2019
@fjolin-intuit
Copy link
Collaborator

Thanks @dreid. I'll see about returning the JSON response.

@fjolin-intuit
Copy link
Collaborator

@dreid We are opening up our clients for contribution for hacktoberfest.

@b4thestorm
Copy link

currently, because it doesn't return JSON, it seems to return nothing. But after Intuit hits your callback url it implicitly passes the access_token and refresh_ token into the auth_client object.

So you write a callback that looks like this:
Screen Shot 2021-01-19 at 11 40 00 AM

and then in the next line, after pdb you can access the access_token like this:
auth_client.access_token
auth_client.refresh_token

nothing is returned from auth_client.get_bearer_token(auth_code)
it is only implicitly added to the auth_client object itself.

@fjolin-intuit
Copy link
Collaborator

Hi @b4thestorm - This is the expected behavior with get_bearer_token making the request :
send_request('POST', self.token_endpoint, headers, self, body=urlencode(body), session=self)
and if things looks good we set the dictionary in that set_attributes(obj, response_json): method. As this isn't a breaking issue - I thought I'd let the community collaborate on it but if enough folks are being confused by it we can have a look at returning the parsed JSON.

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

3 participants