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

Add cognito refresh token as an accepted auth method #42

Merged
merged 6 commits into from
Aug 11, 2023
Merged

Conversation

cranti
Copy link
Contributor

@cranti cranti commented Aug 9, 2023

I added some unit tests, and I have been testing the refresh logic locally. I'd also love for a reviewer to install from this branch & test it!

With a refresh token & client ID, here's an example of the type of testing I've been doing...

from pprint import pprint

from runeq import initialize
from runeq.resources.user import get_current_user
from runeq.resources.stream_metadata import get_patient_stream_metadata
from runeq.resources.org import set_active_org

initialize(
    cognito_refresh_token='TODO', 
    cognito_client_id='TODO'
)

# make some GraphQL requests
print(get_current_user())
set_active_org('TODO_ORG_ID')

# fetch a little bit of data, just to use the Stream API
all_sm = get_patient_stream_metadata(patient_id='TODO_PATIENT_ID')
for sm in all_sm:
    for data in sm.iter_stream_data(format='json', limit=5):
        pprint(data)
        print('--')
    break

@cranti cranti marked this pull request as ready for review August 9, 2023 16:34
Copy link

@vijaveinbergs vijaveinbergs left a comment

Choose a reason for hiding this comment

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

lgtm! tested locally with a refresh token and was able to fetch some data

@cranti cranti merged commit 6e60d19 into main Aug 11, 2023
8 checks passed
@cranti cranti deleted the jwt-refresh branch August 11, 2023 20:01
@cranti cranti mentioned this pull request Aug 16, 2023
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