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

Panopto-oauth2-integration documentation #120

Merged
merged 23 commits into from
Dec 21, 2024
Merged

Conversation

washyking
Copy link
Contributor

Description

Added documentation for Panopto OAuth2 integration.

This documentation provides a step-by-step guide on how to integrate the Deakin Panopto video uploader with the OnTrack system. It includes details on setting up OAuth2 authentication, creating sessions, and uploading videos to Panopto using the API. The guide is intended to streamline the integration process and assist with successful API calls for video uploads.

Type of change

  • Documentation (new)

Copy link

netlify bot commented Dec 9, 2024

Deploy Preview for strong-fairy-c1bde1 failed.

Name Link
🔨 Latest commit 0e73811
🔍 Latest deploy log https://app.netlify.com/sites/strong-fairy-c1bde1/deploys/675a90da07d492000878a88e

Copy link

netlify bot commented Dec 9, 2024

Deploy Preview for thoth-tech failed.

Name Link
🔨 Latest commit 0e73811
🔍 Latest deploy log https://app.netlify.com/sites/thoth-tech/deploys/675a90dad68e6f00084378f1

Copy link

@epineto epineto left a comment

Choose a reason for hiding this comment

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

Pull Request Review - Request Changes

Summary

Thank you for your effort in documenting the Panopto OAuth2 Integration process. The documentation is well-organized, and the steps are detailed enough for developers to follow. However, I have identified a few areas where improvements can be made for consistency, technical accuracy, and clarity.

For your convenience, I am attaching a revised version of the Markdown file with the suggested changes for your appreciation and guidance:
Panopto_OAuth2_Integration_Guide_version2.md


Positive Feedback

  1. The instructions for creating an API client in Step 1 are clear and provide practical examples, such as naming the client and setting the application type.
  2. Including an example redirect URL in Step 3 is very helpful and makes the OAuth2 flow easier to understand.
  3. The code snippet for the curl request is well-structured and clearly demonstrates the required parameters for token exchange.

Requested Changes

Correct Technical Details
  • File Section: curl command
    Suggestion:
    Ensure the grant_type parameter is spelled correctly as authorization_code (American English), as per the OAuth2 standard and Panopto's API requirements.

  • File Section: Placeholder explanations (client_id, redirect_uri, code)
    Suggestion:
    Update the placeholder explanation for client_id, redirect_uri, and code to explicitly clarify how these values should be obtained or configured.


Improve Clarity and Readability
  • File Section: curl example
    Suggestion:
    Add inline comments in the curl example to describe the purpose of each parameter (e.g., grant type, authorization code, redirect URI, client ID, and client secret).

  • File Section: Refresh tokens in Step 4
    Suggestion:
    Expand the explanation of the refresh token usage. Highlight how it simplifies user re-authentication for recurring uploads.


Address Development vs. Production Configurations
  • File Section: CORS configuration in Step 2
    Suggestion:
    Include a note about updating the CORS settings for production environments with the actual production domain (e.g., https://myapp.com), as https://localhost is only suitable for local development.

Security Recommendations
  • File Section: HTTPS for production
    Suggestion:
    Add a reminder to use HTTPS for all communications in production to ensure secure token handling.

  • File Section: Secure credential storage
    Suggestion:
    Emphasize the importance of storing sensitive credentials (like client secrets) in a secure secret manager instead of hardcoding them or storing them in plaintext.


Error Handling
  • File Section: Step 4 (Integrating with OnTrack)
    Suggestion:
    Recommend implementing robust error handling for cases where tokens expire or are invalid. This ensures smooth operation and a better user experience.

Additional Suggestions

  • File Section: Common Errors and Troubleshooting
    Suggestion:
    Add a "Common Errors and Troubleshooting" section to help developers resolve potential issues, such as:
    • Mismatched redirect URIs.
    • Expired or invalid tokens.
    • Incorrectly configured API client credentials.

Conclusion

These changes will make the documentation more accurate, user-friendly, and secure, while aligning with OAuth2 best practices. Once these updates are made, I will be happy to approve the PR. Let me know if you have any questions about the requested changes.

Copy link

Choose a reason for hiding this comment

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

Panopto_OAuth2_Integration_Guide_version2.md

Consistency and Accuracy


File Section: OAuth2 Authorization URL
Suggestion: The authorization URL provided is accurate. However, it might be helpful to explicitly mention replacing both the client_id and redirect_uri placeholders with actual values. Example:
"Replace YOUR_CLIENT_ID with the actual client ID provided in Step 1 and ensure the redirect URI exactly matches the one configured in Panopto."

Technical Details


File Section: grant_type=authorisation_code
Suggestion: The grant type is currently spelled as authorisation_code (British English). According to OAuth2 standards and Panopto's documentation, the correct spelling is authorization_code (American English). Please update this to ensure compatibility with Panopto's API.

CORS and Redirect Configuration


File Section: Redirect URI Configuration
Suggestion: Consider clarifying that the redirect URI should be registered exactly as defined, including the protocol (http:// or https://) and port number. For example:
"Ensure the redirect URI configured in Panopto matches http://localhost:9127/redirect exactly, as mismatched URIs will cause authentication errors."

Readability


File Section: Code Block for curl Token Exchange
Suggestion: The curl example for exchanging the authorization code for a token is clear. To improve readability, consider adding comments above each parameter to explain their purpose.
Example:
Example:

# The grant type being used for the exchange
-d "grant_type=authorization_code" \
# The authorization code obtained in Step 3
-d "code=YOUR_AUTHORIZATION_CODE" \
# The redirect URI registered in Panopto
-d "redirect_uri=http://localhost:9127/redirect" \
# The client ID generated in Step 1
-d "client_id=YOUR_CLIENT_ID" \
# The client secret generated in Step 1
-d "client_secret=YOUR_CLIENT_SECRET"

Additional Feedback


File Section: Step 1 (Creating the API Client)
Comment: The instructions for creating the API client are clear and detailed. Providing an example of a client name (e.g., "OnTrack Integration Client") helps the user understand what’s expected. Great job!

File Section: Step 3 (Authorization Code Flow)
Comment: The explanation of the authorization code flow is thorough and well-structured. Including the redirect example URL (http://localhost:9127/redirect?code=AUTHORIZATION_CODE) makes the process easy to follow.

File Section: Handling Refresh Tokens
Comment: It might be beneficial to include a brief explanation of how refresh tokens can improve user experience by reducing the need for re-authorization. For example:
"Refresh tokens allow the application to request new access tokens without prompting the user, thereby streamlining the experience for recurring video uploads."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, thank you so much for the review, additionally thank you greatly as well for the improvements. Its very informative having a different set of eyes to look at the documentation which I probably assumed a lot of prior knowledge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@epineto Just added you changes. Thanks again for the comment

Copy link

Choose a reason for hiding this comment

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

Hi @washyking,

Thank you for your quick and thoughtful response to the feedback, as well as for incorporating the suggested changes. It’s been a pleasure reviewing your work, and I appreciate the effort you’ve put into improving the documentation. The updated version looks fantastic and addresses all the points raised, making it much clearer and more user-friendly.

Your openness to feedback and prompt actions truly reflect great collaboration skills. Keep up the amazing work!

Copy link

@epineto epineto left a comment

Choose a reason for hiding this comment

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

Pull Request Review - Approved

Hi @washyking,

I’ve reviewed the updated version of the documentation, and I’m pleased to say that all the requested changes have been implemented perfectly. The documentation is now technically accurate, easy to follow, and aligns well with best practices.

With these updates, I’m happy to approve this pull request. Great job again, and thank you for your efforts in enhancing the quality of this guide!

#### 1. Initiate Multipart Upload:
- Get the Upload URL: After creating a session, extract the ```UploadTarget``` URL from the session creation response. This URL specifies where the video should be uploaded.

- Set Up AWS SDK : Even though Panopto doesn’t require AWS credentials, use AWS SDK to handle the multipart upload. Initialise the SDK with dummy credentials (to bypass authentication but still use the multipart upload logic).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use of standard library is preferred over introducing new wrapper libraries. Specially, when they are platform specific, like AWS S3, which can introduce breaking changes depending on the direction the platform takes.

See the second answer in this post to see how a multipart file upload can be done with standard library in ruby. https://stackoverflow.com/a/46669328

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’ve read the comment and made the changes accordingly. I replaced the use of AWS SDK with Rubys standard library for the multipart file upload, as suggested.

)

# Initiate multipart upload
mpu = s3.create_multipart_upload(Bucket: 'upload-bucket', Key: 'video-file.mp4')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the concept of bucket exist in Panopto or is this just a dummy too?
If Panopto offers storage via only S3 compatible object storage, then using the AWS SDK might make sense, but I doubt that is the case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Panopto uses S3-compatible object storage for uploading files. The concept of a bucket in Panopto is different from AWS S3. The S3 multipart upload method is how I chose to handle the file upload, but the actual storage is managed by Panopto, not AWS S3

Using ruby libraries only excludes AWS
@aNebula
Copy link
Collaborator

aNebula commented Dec 21, 2024

Integration plan looks good.
Does the upload process in this PR override the upload process documentation in #124 ? Because I see the same file there and I see AWS S3 instructions in that PR.

If that is the case, PR 124 should be closed @washyking .

@aNebula aNebula mentioned this pull request Dec 21, 2024
1 task
@aNebula aNebula merged commit 73b7100 into thoth-tech:main Dec 21, 2024
0 of 9 checks passed
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.

3 participants