From 94538bdfdb92a6cd9e933286be5776b02c9fb30a Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:49:02 +0800 Subject: [PATCH 01/23] Create panopto-oauth2-intergration-plan --- .../panopoto-integration/panopto-oauth2-intergration-plan | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan @@ -0,0 +1 @@ + From 8a082e5b4f543f6c9f3f0cb45af8adbdb3f51543 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:49:47 +0800 Subject: [PATCH 02/23] Update panopto-oauth2-intergration-plan --- .../panopoto-integration/panopto-oauth2-intergration-plan | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan index 8b137891..8acc2062 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan @@ -1 +1,3 @@ +# Panopto Integration using Oauth2 + From e72a2a05c9c7803f6d9b9095ed6691a91471a120 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:51:33 +0800 Subject: [PATCH 03/23] Update panopto-oauth2-intergration-plan --- .../panopoto-integration/panopto-oauth2-intergration-plan | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan index 8acc2062..30421edb 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan @@ -1,3 +1,7 @@ +--- +title: "Spike Guidance: Integrating Panopto with OnTrack" +--- -# Panopto Integration using Oauth2 +# Panopto Integration +## Api Client From bf626e2543a074886e04f0d4ea6350d775f923ef Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:53:40 +0800 Subject: [PATCH 04/23] Update panopto-oauth2-intergration-plan --- .../panopoto-integration/panopto-oauth2-intergration-plan | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan index 30421edb..6eb3b029 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan @@ -4,4 +4,4 @@ title: "Spike Guidance: Integrating Panopto with OnTrack" # Panopto Integration -## Api Client +## Api Client From a486d67b66c7ad4b101405910cbb447b0e9f39f0 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:55:13 +0800 Subject: [PATCH 05/23] Rename panopto-oauth2-intergration-plan to panopto-oauth2-intergration-plan.md --- ...uth2-intergration-plan => panopto-oauth2-intergration-plan.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/content/docs/products/ontrack/documentation/panopoto-integration/{panopto-oauth2-intergration-plan => panopto-oauth2-intergration-plan.md} (100%) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md similarity index 100% rename from src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan rename to src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md From 55db33ce6e6013a1385010c63ccd252bff4c1ae1 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:55:59 +0800 Subject: [PATCH 06/23] Update panopto-oauth2-intergration-plan.md --- .../panopoto-integration/panopto-oauth2-intergration-plan.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index 6eb3b029..1413f88c 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -1,7 +1,7 @@ --- -title: "Spike Guidance: Integrating Panopto with OnTrack" +title: "Integrating Panopto with OnTrack through Oauth2" --- # Panopto Integration -## Api Client +## Oauth2 panopto api client From 76075a65daaeecedd9e4dad50c687f9744a465c0 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:15:48 +0800 Subject: [PATCH 07/23] Update panopto-oauth2-intergration-plan.md --- .../panopto-oauth2-intergration-plan.md | 47 +++++++++++++++++-- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index 1413f88c..f89e52c4 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -1,7 +1,44 @@ ---- -title: "Integrating Panopto with OnTrack through Oauth2" ---- +# Panopto OAuth2 Integration Guide +## OAuth2 Panopto API Client Setup +To upload videos to a user's personal Panopto instance, we need to authenticate using OAuth2. Below is a step-by-step guide on how to set up the OAuth2 client and retrieve the access token required for API calls. -# Panopto Integration +# Step 1: Create an API Client on Panopto +Navigate to the Panopto website: +Panopto Login -## Oauth2 panopto api client +Go to User Settings: + +Click on the User Settings icon (usually in the top-right corner). +Create a New API Client: + +Under the API Client section, click Create New Client. +Configure the API Client: + +Set a name for the client (e.g., Doubtfire API Client). +Choose Server-side Application as the client type since we’re integrating this into the backend of doubtfire-api. +Save Your Credentials: + +Make sure to note down your Client ID and Client Secret. These will be used to authenticate requests. + +Screenshot 2024-12-05 at 5 58 26 pm + +# Step 2: Configure Allowed URLs and Redirect URI +Set CORS (Cross-Origin Resource Sharing): + +In the Allowed URL section, set CORS to https://localhost. +Set Redirect URI: + +Set the Redirect URI to http://localhost:9127/redirect. +The port number 9127 is arbitrary and is used for local development. +# Step 3: Exchange the Code for an Access Token +Once the API client is set up, the next step involves exchanging the authorisation code for an access token, which will be used for uploading videos. The OAuth2 authentication flow involves the following: + +Visit the Authorisation URL: + +This will initiate the OAuth2 authorisation process, where you will log in and grant access. +Exchange Authorisation Code for Access Token: + +After successful authentication, you will receive an authorisation code. This code can be exchanged for an access token, which will allow uploading videos to the user's Panopto instance. +## Retrieval of access_token + +## Automating access_token refresh and From f08129e389732793430698ea23a0b22a3e461c59 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:21:11 +0800 Subject: [PATCH 08/23] Update panopto-oauth2-intergration-plan.md --- .../panopto-oauth2-intergration-plan.md | 46 +++++++------------ 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index f89e52c4..c2af5daa 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -3,42 +3,30 @@ To upload videos to a user's personal Panopto instance, we need to authenticate using OAuth2. Below is a step-by-step guide on how to set up the OAuth2 client and retrieve the access token required for API calls. # Step 1: Create an API Client on Panopto -Navigate to the Panopto website: -Panopto Login - -Go to User Settings: - -Click on the User Settings icon (usually in the top-right corner). -Create a New API Client: - -Under the API Client section, click Create New Client. -Configure the API Client: - -Set a name for the client (e.g., Doubtfire API Client). -Choose Server-side Application as the client type since we’re integrating this into the backend of doubtfire-api. -Save Your Credentials: - -Make sure to note down your Client ID and Client Secret. These will be used to authenticate requests. +1. Navigate to the Panopto website: +[Panopto Login](https://deakin.au.panopto.com/Panopto/Pages/Home.aspx) + +2. Go to User Settings: + Click on the User Settings icon (usually in the top-right corner). +3. Create a New API Client: + Under the API Client section, click Create New Client. +4. Configure the API Client: + Set a name for the client (e.g., Doubtfire API Client). + Choose Server-side Application as the client type since we’re integrating this into the backend of doubtfire-api. +5. Save Your Credentials: + Make sure to note down your Client ID and Client Secret. These will be used to authenticate requests. Screenshot 2024-12-05 at 5 58 26 pm # Step 2: Configure Allowed URLs and Redirect URI -Set CORS (Cross-Origin Resource Sharing): - -In the Allowed URL section, set CORS to https://localhost. -Set Redirect URI: +1. Set CORS (Cross-Origin Resource Sharing): + In the Allowed URL section, set CORS to https://localhost. +2. Set Redirect URI: + Set the Redirect URI to http://localhost:9127/redirect. + The port number 9127 is arbitrary and is used for local development. -Set the Redirect URI to http://localhost:9127/redirect. -The port number 9127 is arbitrary and is used for local development. # Step 3: Exchange the Code for an Access Token -Once the API client is set up, the next step involves exchanging the authorisation code for an access token, which will be used for uploading videos. The OAuth2 authentication flow involves the following: - -Visit the Authorisation URL: - -This will initiate the OAuth2 authorisation process, where you will log in and grant access. -Exchange Authorisation Code for Access Token: -After successful authentication, you will receive an authorisation code. This code can be exchanged for an access token, which will allow uploading videos to the user's Panopto instance. ## Retrieval of access_token ## Automating access_token refresh and From 4ae0df4fca2811146770d44fa6bc1a086508c362 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Sat, 7 Dec 2024 11:23:34 +0800 Subject: [PATCH 09/23] Update panopto-oauth2-intergration-plan.md --- .../panopto-oauth2-intergration-plan.md | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index c2af5daa..5908fde1 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -2,31 +2,35 @@ ## OAuth2 Panopto API Client Setup To upload videos to a user's personal Panopto instance, we need to authenticate using OAuth2. Below is a step-by-step guide on how to set up the OAuth2 client and retrieve the access token required for API calls. -# Step 1: Create an API Client on Panopto +## Step 1: Create an API Client on Panopto 1. Navigate to the Panopto website: -[Panopto Login](https://deakin.au.panopto.com/Panopto/Pages/Home.aspx) +- [Panopto Login](https://deakin.au.panopto.com/Panopto/Pages/Home.aspx) 2. Go to User Settings: - Click on the User Settings icon (usually in the top-right corner). + - Click on the User Settings icon (usually in the top-right corner). 3. Create a New API Client: - Under the API Client section, click Create New Client. + - Under the API Client section, click Create New Client. 4. Configure the API Client: - Set a name for the client (e.g., Doubtfire API Client). - Choose Server-side Application as the client type since we’re integrating this into the backend of doubtfire-api. + - Set a name for the client (e.g., Doubtfire API Client). + - Choose Server-side Application as the client type since we’re integrating this into the backend of doubtfire-api. 5. Save Your Credentials: - Make sure to note down your Client ID and Client Secret. These will be used to authenticate requests. + - Make sure to note down your Client ID and Client Secret. These will be used to authenticate requests. Screenshot 2024-12-05 at 5 58 26 pm -# Step 2: Configure Allowed URLs and Redirect URI +## Step 2: Configure Allowed URLs and Redirect URI 1. Set CORS (Cross-Origin Resource Sharing): - In the Allowed URL section, set CORS to https://localhost. + - In the Allowed URL section, set CORS to https://localhost. 2. Set Redirect URI: - Set the Redirect URI to http://localhost:9127/redirect. - The port number 9127 is arbitrary and is used for local development. + - Set the Redirect URI to http://localhost:9127/redirect. + - The port number 9127 is arbitrary and is used for local development. -# Step 3: Exchange the Code for an Access Token +## Step 3: Exchange the Code for an Access Token +Once the API client is set up, the next step involves exchanging the authorisation code for an access token, which will be used for uploading videos. The OAuth2 authentication flow involves the following: -## Retrieval of access_token +1. Visit the Authorisation URL: -## Automating access_token refresh and + - This will initiate the OAuth2 authorisation process, where you will log in and grant access. +2. Exchange Authorisation Code for Access Token: + + - After successful authentication, you will receive an authorisation code. This code can be exchanged for an access token, which will allow uploading videos to the user's Panopto instance. From c9ff12d23f7e566cb5ffb5fa92d7eca859bd4342 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Sat, 7 Dec 2024 11:35:53 +0800 Subject: [PATCH 10/23] Update panopto-oauth2-intergration-plan.md --- .../panopto-oauth2-intergration-plan.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index 5908fde1..8df64b95 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -31,6 +31,12 @@ Once the API client is set up, the next step involves exchanging the authorisati 1. Visit the Authorisation URL: - This will initiate the OAuth2 authorisation process, where you will log in and grant access. -2. Exchange Authorisation Code for Access Token: + + # How to + + - Reaplce ' insert_client_id ' with your client id and ' port ' with the port used in the api client setup + - https://deakin.au.panopto.com/Panopto/oauth2/connect/authorize?client_id=insert_client_id&response_type=code&redirect_uri=http://localhost:port&scope=openid%20api&nonce=12345![image] + +3. Exchange Authorisation Code for Access Token: - After successful authentication, you will receive an authorisation code. This code can be exchanged for an access token, which will allow uploading videos to the user's Panopto instance. From fa29c8b65254b979eee460c78af5352e6f917592 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Sat, 7 Dec 2024 13:53:47 +0800 Subject: [PATCH 11/23] Update panopto-oauth2-intergration-plan.md --- .../panopto-oauth2-intergration-plan.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index 8df64b95..ebc1e683 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -34,9 +34,12 @@ Once the API client is set up, the next step involves exchanging the authorisati # How to - - Reaplce ' insert_client_id ' with your client id and ' port ' with the port used in the api client setup - - https://deakin.au.panopto.com/Panopto/oauth2/connect/authorize?client_id=insert_client_id&response_type=code&redirect_uri=http://localhost:port&scope=openid%20api&nonce=12345![image] + - Reaplce `insert_client_id` with your client id and `port` with the port used in the api client setup + - https://deakin.au.panopto.com/Panopto/oauth2/connect/authorize?client_id=insert_client_id&response_type=code&redirect_uri=http://localhost:port&scope=openid%20api&nonce=12345 3. Exchange Authorisation Code for Access Token: - After successful authentication, you will receive an authorisation code. This code can be exchanged for an access token, which will allow uploading videos to the user's Panopto instance. +## Step 4: Integrating with ontrack +1. The next steps of the task is to integrate with ontrack by automating the retrieval of the autheticatio phase and retrieval or bearers token +2. Additionally sd From 8965dc3a258650ef9801cc9cedb91de6955e48f3 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Sat, 7 Dec 2024 14:20:57 +0800 Subject: [PATCH 12/23] Update panopto-oauth2-intergration-plan.md --- .../panopto-oauth2-intergration-plan.md | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index ebc1e683..0c85dd11 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -32,14 +32,31 @@ Once the API client is set up, the next step involves exchanging the authorisati - This will initiate the OAuth2 authorisation process, where you will log in and grant access. - # How to + ### How to manually recieve code - - Reaplce `insert_client_id` with your client id and `port` with the port used in the api client setup + - Replace `insert_client_id` with your client id and `port` with the port used in the api client setup - https://deakin.au.panopto.com/Panopto/oauth2/connect/authorize?client_id=insert_client_id&response_type=code&redirect_uri=http://localhost:port&scope=openid%20api&nonce=12345 + 3. Exchange Authorisation Code for Access Token: - After successful authentication, you will receive an authorisation code. This code can be exchanged for an access token, which will allow uploading videos to the user's Panopto instance. + + ### How to manually recieve access token + + - Using the curl request below replacing `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET` and `YOUR_AUTHORISATION_CODE` + +``` Typescript + curl -X POST "https://deakin.au.panopto.com/Panopto/oauth2/connect/token" \ + -H "Content-Type: application/x-www-form-urlencoded" \ + -d "grant_type=authorisation_code" \ + -d "code=YOUR_AUTHORISATION_CODE" \ + -d "redirect_uri=http://localhost:8000" \ + -d "client_id=YOUR_CLIENT_ID" \ + -d "client_secret=YOUR_CLIENT_SECRET" +``` + ## Step 4: Integrating with ontrack -1. The next steps of the task is to integrate with ontrack by automating the retrieval of the autheticatio phase and retrieval or bearers token -2. Additionally sd +1. The next steps of the task is to automate the entire process so that you supply an `env` file with `client_id` and `client_secret`. +2. It provides you with a link to click on, which give the program the authorisation code. +3. With this it retrieves the access token for your panopto instance and allowing a video upload to occur using the api From f9ee8117aa50a6fa162f26b89f14fb63a78d08c2 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:24:17 +0800 Subject: [PATCH 13/23] Create panopto-upload-process --- .../documentation/panopoto-integration/panopto-upload-process | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process @@ -0,0 +1 @@ + From 02db81307b2b93f915f4751e1b36df54c07edd26 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:29:16 +0800 Subject: [PATCH 14/23] Update panopto-upload-process --- .../panopoto-integration/panopto-upload-process | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process index 8b137891..cb73eb8e 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process @@ -1 +1,17 @@ +# Panopto Video Upload Process Guide +## Overview +This document provides a step-by-step guide on how to upload videos to Panopto using the Panopto REST API. The process includes creating a session, uploading the video file using multipart upload, creating a manifest, and finalizing the upload. + +--- + +## Step 1: Create a Session for Video Upload + +Before uploading a video, a session must be created. The session provides the necessary details for the upload process, including the upload target and session ID. + +### 1.1 Call the Session Creation API +The session creation process is triggered by sending a POST request to the `sessionUpload` endpoint. + +- **API Endpoint:** + ```http + POST https://{server}/Panopto/PublicAPI/REST/sessionUpload From 05ef8c414addf91f547cbf10c7fc7e988d1ea4c0 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:29:38 +0800 Subject: [PATCH 15/23] Rename panopto-upload-process to panopto-upload-process.md --- .../{panopto-upload-process => panopto-upload-process.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/content/docs/products/ontrack/documentation/panopoto-integration/{panopto-upload-process => panopto-upload-process.md} (100%) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md similarity index 100% rename from src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process rename to src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md From 7f647eea1cc31e6d6eac37f3588ecd40f1541a1d Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:43:25 +0800 Subject: [PATCH 16/23] Update panopto-upload-process.md --- .../panopto-upload-process.md | 54 +++++++++++++++++-- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md index cb73eb8e..01f6bb42 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md @@ -1,7 +1,7 @@ # Panopto Video Upload Process Guide ## Overview -This document provides a step-by-step guide on how to upload videos to Panopto using the Panopto REST API. The process includes creating a session, uploading the video file using multipart upload, creating a manifest, and finalizing the upload. +This document provides a step-by-step guide on how to upload videos to Panopto using the Panopto REST API. The process includes creating a session, uploading the video file using multipart upload, creating a manifest, and finalising the upload. --- @@ -9,9 +9,57 @@ This document provides a step-by-step guide on how to upload videos to Panopto u Before uploading a video, a session must be created. The session provides the necessary details for the upload process, including the upload target and session ID. -### 1.1 Call the Session Creation API +### Call the Session Creation API The session creation process is triggered by sending a POST request to the `sessionUpload` endpoint. - **API Endpoint:** - ```http + ```ruby POST https://{server}/Panopto/PublicAPI/REST/sessionUpload + ``` +- **Payload:** + ```http + { + "FolderId": "{folder_id}" + } + + ``` +- **Example Session Creation:** + ```ruby + response = RestClient.post( + "https://#{server}/Panopto/PublicAPI/REST/sessionUpload", + { "FolderId" => folder_id }.to_json, + { content_type: :json, accept: :json, authorization: "Bearer #{access_token}" } + ) + ``` + +- **Example Response:** + ```http + { + "ID": "session_id", + "UploadTarget": "upload_target_url", + "FolderId": "{folder_id}" + } + ``` +## Step 2: Upload Video via Multipart Upload +Panopto supports multipart uploads for large video files. This step uploads the video in parts to the upload target specified in the session creation response. + +### Initiate Multipart Upload: + +- Use AWS SDK (boto3) to initiate a multipart upload. +- Upload URL: Extracted from the UploadTarget parameter in the session creation response. +### Upload Parts: + +- Split the video file into parts ( 5MB at most per part) and upload each part sequentially. +- AWS SDK Multipart Upload Example: +```ruby + +s3 = Aws::S3::Client.new( + endpoint: upload_target, + region: 'us-east-1', + access_key_id: 'dummy', + secret_access_key: 'dummy' +) +``` +Complete Multipart Upload: + +Once all parts are uploaded, call the complete_multipart_upload method to finalise the upload. From 4f5f03dad10f13cb4aefc323d35728623e50639d Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:58:55 +0800 Subject: [PATCH 17/23] Update panopto-upload-process.md --- .../panopto-upload-process.md | 56 ++++++++++++++++--- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md index 01f6bb42..ac9e11be 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md @@ -43,23 +43,63 @@ The session creation process is triggered by sending a POST request to the `sess ## Step 2: Upload Video via Multipart Upload Panopto supports multipart uploads for large video files. This step uploads the video in parts to the upload target specified in the session creation response. -### Initiate Multipart Upload: +#### 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. -- Use AWS SDK (boto3) to initiate a multipart upload. -- Upload URL: Extracted from the UploadTarget parameter in the session creation response. -### Upload Parts: +- Set Up AWS SDK (boto3): Even though Panopto doesn’t require AWS credentials, we use AWS SDK to handle the multipart upload. Initialise the SDK with dummy credentials (to bypass authentication but still use the multipart upload logic). + +Sample Code: -- Split the video file into parts ( 5MB at most per part) and upload each part sequentially. -- AWS SDK Multipart Upload Example: ```ruby +# Extract the Upload Target URL from the session creation response +upload_target = "https://deakin.au.panopto.com/Panopto/Upload/..." +# Set up AWS SDK for multipart upload s3 = Aws::S3::Client.new( endpoint: upload_target, region: 'us-east-1', access_key_id: 'dummy', secret_access_key: 'dummy' ) + +# Initiate multipart upload +mpu = s3.create_multipart_upload(Bucket: 'upload-bucket', Key: 'video-file.mp4') +upload_id = mpu['UploadId'] +``` +### 2. Upload Parts: +Split the Video File: Split the video into parts, each no larger than 5MB. You can adjust the part size as needed. + +Upload Each Part: Iterate over the parts and upload them using the AWS SDK. Track the ETag for each part. + +Sample Code: + +```ruby +# Read the video file in 5MB chunks and upload parts +File.open('video_path.mp4', 'rb') do |file| + part_number = 1 + while (chunk = file.read(5 * 1024 * 1024)) # 5MB per part + s3.upload_part( + bucket: 'upload-bucket', + key: 'test-video.mp4', + part_number: part_number, + upload_id: upload_id, + body: chunk + ) + part_number += 1 + end +end +``` +### 3. Complete Multipart Upload: +- Finalise the Upload: Once all parts have been uploaded, call the complete_multipart_upload method to combine the parts into one video file in Panopto. +Sample Code: + +```ruby +# After all parts have been uploaded, complete the upload +s3.complete_multipart_upload( + bucket: 'upload-bucket', + key: 'video-file.mp4', + upload_id: upload_id, + multipart_upload: { parts: parts_metadata } # Metadata about each uploaded part +) ``` -Complete Multipart Upload: -Once all parts are uploaded, call the complete_multipart_upload method to finalise the upload. From 6f65e8ef7e26102288a0e37cc0c506ece9b434a5 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:32:58 +0800 Subject: [PATCH 18/23] Update panopto-upload-process.md --- .../panopto-upload-process.md | 86 +++++++++++++++++-- 1 file changed, 79 insertions(+), 7 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md index ac9e11be..94cf5751 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md @@ -48,8 +48,6 @@ Panopto supports multipart uploads for large video files. This step uploads the - Set Up AWS SDK (boto3): Even though Panopto doesn’t require AWS credentials, we use AWS SDK to handle the multipart upload. Initialise the SDK with dummy credentials (to bypass authentication but still use the multipart upload logic). -Sample Code: - ```ruby # Extract the Upload Target URL from the session creation response upload_target = "https://deakin.au.panopto.com/Panopto/Upload/..." @@ -67,11 +65,9 @@ mpu = s3.create_multipart_upload(Bucket: 'upload-bucket', Key: 'video-file.mp4') upload_id = mpu['UploadId'] ``` ### 2. Upload Parts: -Split the Video File: Split the video into parts, each no larger than 5MB. You can adjust the part size as needed. - -Upload Each Part: Iterate over the parts and upload them using the AWS SDK. Track the ETag for each part. +- Split the Video File: Split the video into parts, each no larger than 5MB. You can adjust the part size as needed. -Sample Code: +- Upload Each Part: Iterate over the parts and upload them using the AWS SDK. Track the ETag for each part. ```ruby # Read the video file in 5MB chunks and upload parts @@ -91,7 +87,6 @@ end ``` ### 3. Complete Multipart Upload: - Finalise the Upload: Once all parts have been uploaded, call the complete_multipart_upload method to combine the parts into one video file in Panopto. -Sample Code: ```ruby # After all parts have been uploaded, complete the upload @@ -102,4 +97,81 @@ s3.complete_multipart_upload( multipart_upload: { parts: parts_metadata } # Metadata about each uploaded part ) ``` +## Step 3: Create and Upload the Manifest File +Once the video is uploaded, the next step is to create the manifest file. The manifest provides metadata for the video, including its title, description, and the file name. + +### 1. Create the Manifest File: +- The manifest file is an XML file that contains the following key elements: + +```xml +Copy code + + + {Video_Title} + {Video_Description} + {Current_Date} + + + + +``` +### 2. Upload the Manifest File: +- The manifest file is uploaded in the same way as the video parts, using multipart upload. +``` Example Upload (Using AWS SDK): +ruby + +s3 = Aws::S3::Client.new( + endpoint: upload_target, + region: 'us-east-1', + access_key_id: 'dummy', + secret_access_key: 'dummy' +) + +s3.put_object(bucket: bucket_name, key: manifest_key, body: File.read(manifest_file)) +``` +## Step 4: Finalise the Upload +After uploading the video and the manifest file, the final step is to finalise the session marking it as complete. + +### 1. Send the PUT Request to Finalise Session: +API Endpoint: + +```ruby +PUT https://{server}/Panopto/PublicAPI/REST/sessionUpload/{session_id} +``` +Payload: + +```ruby + +{ + "State": 1, # Mark as completed + "FolderId": "{folder_id}" +} +``` +Example Code: + +```ruby +RestClient.put( + "https://#{@server}/Panopto/PublicAPI/REST/sessionUpload/#{@session_id}", + { "State" => 1, "FolderId" => @folder_id }.to_json, + { content_type: :json, accept: :json, authorization: "Bearer #{@access_token}" } +) +``` +## 2. Monitor the Upload Status: +- Check for Processing: After finalising, periodically check the session state to ensure it is processed and completed. + +Polling Example: + +```ruby +while true + sleep(5) # Wait a few seconds before checking status + session = RestClient.get("https://#{@server}/Panopto/PublicAPI/REST/sessionUpload/#{@session_id}") + if JSON.parse(session.body)["State"] == 4 # State 4 means processing complete + break + end +end +``` From 809618b533ca221a3308a88a7e3c76c05b322e67 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:34:58 +0800 Subject: [PATCH 19/23] Update panopto-upload-process.md --- .../panopoto-integration/panopto-upload-process.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md index 94cf5751..64dddd1e 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md @@ -1,7 +1,7 @@ -# Panopto Video Upload Process Guide +# Panopto Video Upload Process ## Overview -This document provides a step-by-step guide on how to upload videos to Panopto using the Panopto REST API. The process includes creating a session, uploading the video file using multipart upload, creating a manifest, and finalising the upload. +This document outlines key information about the process of uploading videos to Panopto using the Panopto REST API. While this isn't a comprehensive guide, it highlights the steps involved in creating a session, performing a multipart upload of the video file, creating the manifest, and finalising the upload. This serves as an informational resource for implementing the video upload functionality in the future. Additional research and context will be needed to fully integrate these steps. --- From 6b841ee3d2032c520485e058d648be2719cc52dc Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:50:09 +0800 Subject: [PATCH 20/23] Update panopto-upload-process.md --- .../panopoto-integration/panopto-upload-process.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md index 64dddd1e..dddc54a5 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md @@ -41,12 +41,12 @@ The session creation process is triggered by sending a POST request to the `sess } ``` ## Step 2: Upload Video via Multipart Upload -Panopto supports multipart uploads for large video files. This step uploads the video in parts to the upload target specified in the session creation response. +Panopto supports multipart uploads for large video files. This step uploads the video in parts to the ```upload target``` specified in the session creation response. #### 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. +- 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 (boto3): Even though Panopto doesn’t require AWS credentials, we use AWS SDK to handle the multipart upload. Initialise the SDK with dummy credentials (to bypass authentication but still use the multipart upload logic). +- Set Up AWS SDK (boto3): 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). ```ruby # Extract the Upload Target URL from the session creation response @@ -67,7 +67,7 @@ upload_id = mpu['UploadId'] ### 2. Upload Parts: - Split the Video File: Split the video into parts, each no larger than 5MB. You can adjust the part size as needed. -- Upload Each Part: Iterate over the parts and upload them using the AWS SDK. Track the ETag for each part. +- Upload Each Part: Iterate over the parts and upload them using the AWS SDK. ```ruby # Read the video file in 5MB chunks and upload parts @@ -86,7 +86,7 @@ File.open('video_path.mp4', 'rb') do |file| end ``` ### 3. Complete Multipart Upload: -- Finalise the Upload: Once all parts have been uploaded, call the complete_multipart_upload method to combine the parts into one video file in Panopto. +- Finalise the Upload: Once all parts have been uploaded, call the ``complete_multipart_upload`` method to combine the parts into one video file in Panopto. ```ruby # After all parts have been uploaded, complete the upload @@ -120,7 +120,7 @@ Copy code ``` ### 2. Upload the Manifest File: -- The manifest file is uploaded in the same way as the video parts, using multipart upload. +- The manifest file is uploaded in the same way as the video parts, using `multipart upload`. ``` Example Upload (Using AWS SDK): ruby @@ -161,7 +161,7 @@ RestClient.put( ) ``` ## 2. Monitor the Upload Status: -- Check for Processing: After finalising, periodically check the session state to ensure it is processed and completed. +- Check for Processing: After finalising, periodically check the `session state` to ensure it is processed and completed. Polling Example: From e27f723e326294e4c35eca5ddb4af398d5942a26 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:50:54 +0800 Subject: [PATCH 21/23] Update panopto-upload-process.md --- .../panopoto-integration/panopto-upload-process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md index dddc54a5..c8c43770 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md @@ -46,7 +46,7 @@ Panopto supports multipart uploads for large video files. This step uploads the #### 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 (boto3): 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). +- 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). ```ruby # Extract the Upload Target URL from the session creation response From 0ef138e431012761bd540f35133ec7dd3e371b65 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:02:27 +0800 Subject: [PATCH 22/23] Update panopto-oauth2 in reference to comments --- .../panopto-oauth2-intergration-plan.md | 130 +++++++++++++----- 1 file changed, 93 insertions(+), 37 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md index 0c85dd11..5b730332 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-oauth2-intergration-plan.md @@ -1,62 +1,118 @@ -# Panopto OAuth2 Integration Guide + +# Panopto OAuth2 Integration Guide (Updated) + +This guide provides a detailed, step-by-step process to integrate Panopto’s OAuth2-based authentication into your backend application (e.g., OnTrack or Doubtfire-API). It covers creating an API client on Panopto, configuring OAuth2 settings, obtaining authorization codes, exchanging them for access tokens, and integrating the process into your application’s workflow. Technical improvements, corrections, and additional recommendations based on best practices have been included. + ## OAuth2 Panopto API Client Setup -To upload videos to a user's personal Panopto instance, we need to authenticate using OAuth2. Below is a step-by-step guide on how to set up the OAuth2 client and retrieve the access token required for API calls. +To upload videos to a user's personal Panopto instance, we need to authenticate using OAuth2. This involves creating an API client on Panopto, configuring redirect URIs and CORS, then performing the OAuth2 Authorization Code flow to retrieve the tokens required for API calls. ## Step 1: Create an API Client on Panopto 1. Navigate to the Panopto website: -- [Panopto Login](https://deakin.au.panopto.com/Panopto/Pages/Home.aspx) + - Panopto Login: [https://deakin.au.panopto.com/Panopto/Pages/Home.aspx](https://deakin.au.panopto.com/Panopto/Pages/Home.aspx) -2. Go to User Settings: +2. Access User Settings: - Click on the User Settings icon (usually in the top-right corner). + 3. Create a New API Client: - - Under the API Client section, click Create New Client. + - Under the API Client section, click "Create New Client". + 4. Configure the API Client: - - Set a name for the client (e.g., Doubtfire API Client). - - Choose Server-side Application as the client type since we’re integrating this into the backend of doubtfire-api. + - Set a name for the client (e.g., "OnTrack Integration Client" or "Doubtfire Integration Client"). + - Choose "Server-side Application" as the client type since the integration is backend-based. + 5. Save Your Credentials: - - Make sure to note down your Client ID and Client Secret. These will be used to authenticate requests. + - Note down your Client ID and Client Secret. These will be used to authenticate requests. + - Store them securely (e.g., environment variables). Do not commit these to version control. +**Example:** +``` +CLIENT_ID=your_panopto_client_id +CLIENT_SECRET=your_panopto_client_secret +``` Screenshot 2024-12-05 at 5 58 26 pm ## Step 2: Configure Allowed URLs and Redirect URI 1. Set CORS (Cross-Origin Resource Sharing): - - In the Allowed URL section, set CORS to https://localhost. + - In the Allowed URL section of the API Client configuration, set CORS to `https://localhost` for local development. + 2. Set Redirect URI: - - Set the Redirect URI to http://localhost:9127/redirect. - - The port number 9127 is arbitrary and is used for local development. + - Set the Redirect URI to `http://localhost:9127/redirect`. + - The port number (9127) is arbitrary and used for local testing. It must match the `redirect_uri` parameter in your application’s OAuth flow exactly. ## Step 3: Exchange the Code for an Access Token -Once the API client is set up, the next step involves exchanging the authorisation code for an access token, which will be used for uploading videos. The OAuth2 authentication flow involves the following: - -1. Visit the Authorisation URL: +Once the API client is set up, the next step is to perform the OAuth2 Authorization Code flow: - - This will initiate the OAuth2 authorisation process, where you will log in and grant access. - - ### How to manually recieve code +### Obtain the Authorization Code +Replace `YOUR_CLIENT_ID` and `YOUR_PORT` as needed: - - Replace `insert_client_id` with your client id and `port` with the port used in the api client setup - - https://deakin.au.panopto.com/Panopto/oauth2/connect/authorize?client_id=insert_client_id&response_type=code&redirect_uri=http://localhost:port&scope=openid%20api&nonce=12345 - +``` +https://deakin.au.panopto.com/Panopto/oauth2/connect/authorize?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://localhost:9127/redirect&scope=openid%20api&nonce=12345 +``` -3. Exchange Authorisation Code for Access Token: +1. Navigate to the above URL in a browser. +2. Log in and grant access when prompted. +3. After approval, Panopto redirects to: + ``` + http://localhost:9127/redirect?code=AUTHORIZATION_CODE + ``` - - After successful authentication, you will receive an authorisation code. This code can be exchanged for an access token, which will allow uploading videos to the user's Panopto instance. - - ### How to manually recieve access token +### Exchange Authorization Code for Access Token +Use the code to request an access token. Note the correction in `grant_type` spelling (`authorization_code`): - - Using the curl request below replacing `YOUR_CLIENT_ID`, `YOUR_CLIENT_SECRET` and `YOUR_AUTHORISATION_CODE` +```bash +curl -X POST "https://deakin.au.panopto.com/Panopto/oauth2/connect/token" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=authorization_code" -d "code=YOUR_AUTHORIZATION_CODE" -d "redirect_uri=http://localhost:9127/redirect" -d "client_id=YOUR_CLIENT_ID" -d "client_secret=YOUR_CLIENT_SECRET" +``` -``` Typescript - curl -X POST "https://deakin.au.panopto.com/Panopto/oauth2/connect/token" \ - -H "Content-Type: application/x-www-form-urlencoded" \ - -d "grant_type=authorisation_code" \ - -d "code=YOUR_AUTHORISATION_CODE" \ - -d "redirect_uri=http://localhost:8000" \ - -d "client_id=YOUR_CLIENT_ID" \ - -d "client_secret=YOUR_CLIENT_SECRET" +**Example Response:** +```json +{ + "access_token": "eyJ...", + "expires_in": 3600, + "token_type": "Bearer", + "scope": "openid api", + "refresh_token": "optional_refresh_token_if_provided" +} ``` -## Step 4: Integrating with ontrack -1. The next steps of the task is to automate the entire process so that you supply an `env` file with `client_id` and `client_secret`. -2. It provides you with a link to click on, which give the program the authorisation code. -3. With this it retrieves the access token for your panopto instance and allowing a video upload to occur using the api +This `access_token` can be used to call Panopto’s API for video uploads. If a `refresh_token` is included, you can use it to obtain new access tokens without user re-authorization. + +## Step 4: Integrating with OnTrack (or Your Backend) +1. **Store Credentials Securely:** + - Create an `.env` file (for local development): + ```env + PANOPTO_CLIENT_ID=your_panopto_client_id + PANOPTO_CLIENT_SECRET=your_panopto_client_secret + PANOPTO_REDIRECT_URI=http://localhost:9127/redirect + ``` + - Load these environment variables in your backend application. + +2. **Authorization Flow Integration:** + - Your backend can present a link to the authorization URL. The user clicks it to start the process. + - After granting access, the backend receives the authorization code at the redirect URI. + - The backend exchanges the code for an access token automatically. + +3. **Video Upload:** + - With a valid access token, your backend can call Panopto’s upload APIs to programmatically upload videos to the user’s personal Panopto instance. + +## Recommendations and Updates +- **Security:** + - Use HTTPS in production for all communications. + - Do not log sensitive tokens (e.g., access tokens or refresh tokens). + - Store secrets securely using a tool like AWS Secrets Manager or HashiCorp Vault. +- **Scalability:** + - Use a shared token storage mechanism (e.g., a database) if running multiple instances of your backend behind a load balancer. +- **Error Handling:** + - Implement retry logic with exponential backoff for transient failures. + - Log errors but ensure no sensitive information (e.g., client secret) is exposed. +- **Version Control:** + - Ensure Panopto API versions are checked periodically for updates. + - Test all API changes in a staging environment before deploying them to production. + +## References +- Panopto Documentation: [https://support.panopto.com/s/docs](https://support.panopto.com/s/docs) +- OAuth2 Specification: [https://oauth.net/2/](https://oauth.net/2/) +- Secret Management: Consider [HashiCorp Vault](https://www.vaultproject.io/) or [AWS Secrets Manager](https://aws.amazon.com/secrets-manager/) for production. + +--- + +By following these steps and best practices, you can seamlessly integrate Panopto’s OAuth2 authentication flow into your backend (e.g., OnTrack or Doubtfire-API), ensuring a smooth and secure process for uploading videos to a user’s Panopto instance. From 0e73811a34f5031367c3b36f163a895e55bff309 Mon Sep 17 00:00:00 2001 From: Alvin Odunga <101785858+washyking@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:29:27 +0800 Subject: [PATCH 23/23] Update panopto-upload-process.md Using ruby libraries only excludes AWS --- .../panopto-upload-process.md | 96 ++++++++++++------- 1 file changed, 59 insertions(+), 37 deletions(-) diff --git a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md index c8c43770..a71517bf 100644 --- a/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md +++ b/src/content/docs/products/ontrack/documentation/panopoto-integration/panopto-upload-process.md @@ -46,41 +46,54 @@ Panopto supports multipart uploads for large video files. This step uploads the #### 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). +- Use `Net::HTTP` and `URI` for Multipart Upload: Use Ruby's standard libraries to handle the multipart upload. The following example demonstrates how to upload a file in parts using `Net::HTTP:` ```ruby + # Extract the Upload Target URL from the session creation response upload_target = "https://deakin.au.panopto.com/Panopto/Upload/..." -# Set up AWS SDK for multipart upload -s3 = Aws::S3::Client.new( - endpoint: upload_target, - region: 'us-east-1', - access_key_id: 'dummy', - secret_access_key: 'dummy' -) -# Initiate multipart upload -mpu = s3.create_multipart_upload(Bucket: 'upload-bucket', Key: 'video-file.mp4') -upload_id = mpu['UploadId'] +# Define the chunk size for multipart upload (5MB per part) +chunk_size = 5 * 1024 * 1024 + +# Initialise upload process +uri = URI(upload_target) +request = Net::HTTP::Post.new(uri) +request['Content-Type'] = 'multipart/form-data' + +# Read and upload the video file in chunks +while chunk = file.read(chunk_size) + form_data = [['file', chunk]] + request.set_form form_data, 'multipart/form-data' + + response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + http.request(request) + end + + # Check the response (e.g., for successful upload) + puts response.body +end ``` ### 2. Upload Parts: - Split the Video File: Split the video into parts, each no larger than 5MB. You can adjust the part size as needed. -- Upload Each Part: Iterate over the parts and upload them using the AWS SDK. +- Upload Each Part: Iterate over the parts and upload them using `Net::HTTP:` ```ruby -# Read the video file in 5MB chunks and upload parts +# Read video file in 5MB chunks and upload each part File.open('video_path.mp4', 'rb') do |file| part_number = 1 while (chunk = file.read(5 * 1024 * 1024)) # 5MB per part - s3.upload_part( - bucket: 'upload-bucket', - key: 'test-video.mp4', - part_number: part_number, - upload_id: upload_id, - body: chunk - ) + form_data = [['file', chunk]] + request.set_form form_data, 'multipart/form-data' + + response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + http.request(request) + end + + # Handle response + puts "Part #{part_number} uploaded: #{response.body}" part_number += 1 end end @@ -89,13 +102,15 @@ end - Finalise the Upload: Once all parts have been uploaded, call the ``complete_multipart_upload`` method to combine the parts into one video file in Panopto. ```ruby -# After all parts have been uploaded, complete the upload -s3.complete_multipart_upload( - bucket: 'upload-bucket', - key: 'video-file.mp4', - upload_id: upload_id, - multipart_upload: { parts: parts_metadata } # Metadata about each uploaded part -) +# Finalise the upload once all parts are uploaded +complete_upload_uri = URI("#{upload_target}/complete") +complete_request = Net::HTTP::Post.new(complete_upload_uri) +complete_request['Content-Type'] = 'application/json' + +# Send the finalisation request +response = Net::HTTP.start(complete_upload_uri.hostname, complete_upload_uri.port, use_ssl: true) do |http| + http.request(complete_request) +end ``` ## Step 3: Create and Upload the Manifest File Once the video is uploaded, the next step is to create the manifest file. The manifest provides metadata for the video, including its title, description, and the file name. @@ -121,17 +136,24 @@ Copy code ``` ### 2. Upload the Manifest File: - The manifest file is uploaded in the same way as the video parts, using `multipart upload`. -``` Example Upload (Using AWS SDK): -ruby - -s3 = Aws::S3::Client.new( - endpoint: upload_target, - region: 'us-east-1', - access_key_id: 'dummy', - secret_access_key: 'dummy' -) -s3.put_object(bucket: bucket_name, key: manifest_key, body: File.read(manifest_file)) +```ruby +manifest_file = 'upload_manifest_generated.xml' +file = File.open(manifest_file, 'rb') + +# Prepare the POST request for multipart upload +request = Net::HTTP::Post.new(uri) +request['Content-Type'] = 'multipart/form-data' + +# Upload the manifest in chunks +while chunk = file.read(5 * 1024 * 1024) # 5MB per part + form_data = [['file', chunk]] + request.set_form form_data, 'multipart/form-data' + + # Send the request to upload the part + response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| + http.request(request) + end ``` ## Step 4: Finalise the Upload After uploading the video and the manifest file, the final step is to finalise the session marking it as complete.