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

Tdl 19157 linkedin oauth add refresh token #41

Merged
merged 6 commits into from
Jun 16, 2022

Conversation

nitingaikwad1
Copy link
Contributor

Description of change

Generate access token programmatically using refresh token

Manual QA steps

Risks

Rollback steps

  • revert this branch

state = {}
if parsed_args.state:
state = parsed_args.state

config = parsed_args.config
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this above L34, we could just used the config instead of parsed_args.config there as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes , i have same changes

Server5xxError,
max_tries=5,
factor=2)
def get_access_token(self):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name get_access_token as a method on a class insinuates that it would return an access token. What would you think about naming this something like fetch_and_set_access_token or something of the like? A little more wordy, but it describes the operation a little more clearly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct i have renamed the method name

if not self.__verified:
self.__verified = self.check_access_token()
self.__verified = self.get_access_token()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible I might be missing something, but I don't think get_access_token returns a value. Also, would this do anything since we call self.get_access_token() on L268? If it wasn't verified then, would it be verified now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it does not return anything , i have corrected it

@@ -141,12 +149,46 @@ def __init__(self,
max_tries=5,
factor=2)
def __enter__(self):
self.__verified = self.check_access_token()
self.__verified = self.get_access_token()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think get_access_token returns anything here, so I don't think self.__verified will ever be set to anything.

I also don't think we use check_access_token anymore. Do we still need that function?

if not self.__verified:
self.__verified = self.check_access_token()
self.__verified = self.fetch_and_set_access_token()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fetch_and_set_access_token is still not returning anything, so I don't think this would work. I think it needs to return what we want to se __verified to, or set __verified in the function.

We also call fetch_and_set_access_token just above in L241. Do we want to call this regardless of whether or not it's been verified? If so, I think we could remove the check here. If not, I think we should remove the call at L241. I believe we only want it to call it when we're not verified, but I could be mistaken.

Copy link

@atribed atribed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me! 🚀

@nitingaikwad1 nitingaikwad1 merged commit 13bc140 into master Jun 16, 2022
@nitingaikwad1 nitingaikwad1 mentioned this pull request Jun 16, 2022
@dsprayberry dsprayberry deleted the TDL-19157-linkedin-oauth-add-refresh-token branch April 10, 2023 17:35
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

Successfully merging this pull request may close these issues.

None yet

2 participants