Skip to content

Conversation

@robrap
Copy link
Contributor

@robrap robrap commented Mar 26, 2019

This library update will be needed by ecommerce in order to get the lms user_id passed through appropriately.

IMPORTANT: This change requires https://github.com/edx/edx-platform/pull/20057 to land before we upgrade services, otherwise edx-platform will send invalid_scope errors.

Additionally, oauth applications are required to have access to the user_id scope in order for this not to break oAuth+SSO flow. There is some follow-up work to ensure this is done for the apps using this flow (ecommerce, credentials, registrar).

ARCH-603

# - See https://github.com/edx/edx-platform/blob/1dd1d25bc44cff99cec849ff4695bb1dc92ddac1/lms/djangoapps/oauth2_handler/handlers.py#L57
# 2. Should this 'user_tracking_id' be removed if it is overwritten in EdXOpenIdConnect?
# 3. Even if 'user_tracking_id' is sent, who uses it? Maybe edx-analytics-dashboard?
'user_tracking_id': 'user_tracking_id',

Choose a reason for hiding this comment

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

This field is set only with OpenID Connect. So you can remove it from here. (Already exists in EdXOpenIdConnect.)

Copy link
Contributor Author

@robrap robrap left a comment

Choose a reason for hiding this comment

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

@nasthagiri @douglashall: This is ready for full review.

"""
Ensure that `user_id` stays in EXTRA_DATA.
"""
self.assertEqual(self.backend.EXTRA_DATA, [('user_id', 'user_id', True)])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

FYI: I didn't want to do an integration test, and I want to ensure this doesn't get lost, so I added a silly simple test.

@robrap robrap changed the title WIP: ARCH-603: Retrieve and map user_id scope. ARCH-603: Retrieve and map user_id scope. Mar 27, 2019

DEFAULT_SCOPE = ['user_id', 'profile', 'email']
discard_missing_values = True
EXTRA_DATA = [('user_id', 'user_id', discard_missing_values)]
Copy link
Contributor

Choose a reason for hiding this comment

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

How is EXTRA_DATA used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@douglashall: I added the comment above to address your question. I also adjusted the commit comment, which you are welcome to review.

BREAKING CHANGE: The user_id scope is now required when using the
EdXOAuth2 backend for oAuth+SSO. This means that the oauth
application must first be configured to have access to the user_id
scope, which is not available by default.

The backend will then pull the user_id from the JWT and store it
in the UserSocialAuth.extra_data field.

ARCH-603
@robrap robrap force-pushed the robrap/ARCH-603-ecommerce-analytics branch from 99d9e60 to f955e55 Compare March 28, 2019 14:00
@robrap robrap merged commit 493f93e into master Mar 28, 2019
@robrap robrap deleted the robrap/ARCH-603-ecommerce-analytics branch March 28, 2019 16:55
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.

4 participants