@@ -257,6 +257,24 @@ static APP_PROVIDERS: &[AppProvider] = &[
257257 } ] ,
258258 refresh : Some ( & GOOGLE_REFRESH ) ,
259259 } ,
260+ AppProvider {
261+ provider : "youtube" ,
262+ display_name : "YouTube" ,
263+ host_rules : & [
264+ HostRule {
265+ host : "youtube.googleapis.com" ,
266+ path_prefix : None ,
267+ strategy : AuthStrategy :: Bearer ,
268+ } ,
269+ // Legacy endpoint — some clients still use www.googleapis.com/youtube/
270+ HostRule {
271+ host : "www.googleapis.com" ,
272+ path_prefix : Some ( "/youtube/" ) ,
273+ strategy : AuthStrategy :: Bearer ,
274+ } ,
275+ ] ,
276+ refresh : Some ( & GOOGLE_REFRESH ) ,
277+ } ,
260278 AppProvider {
261279 provider : "google-health" ,
262280 display_name : "Google Health" ,
@@ -712,6 +730,10 @@ mod tests {
712730 providers_for_host( "health.googleapis.com" ) ,
713731 vec![ "google-health" ]
714732 ) ;
733+ assert_eq ! (
734+ providers_for_host( "youtube.googleapis.com" ) ,
735+ vec![ "youtube" ]
736+ ) ;
715737 }
716738
717739 #[ test]
@@ -729,6 +751,7 @@ mod tests {
729751 ( "google-meet" , "meet.googleapis.com" ) ,
730752 ( "google-photos" , "photoslibrary.googleapis.com" ) ,
731753 ( "google-health" , "health.googleapis.com" ) ,
754+ ( "youtube" , "youtube.googleapis.com" ) ,
732755 ] ;
733756 for ( provider, host) in & hosts {
734757 let injections = build_app_injections ( provider, host, "ya29.test" ) ;
@@ -856,6 +879,9 @@ mod tests {
856879
857880 let result = provider_for_host_and_path ( "www.googleapis.com" , "/drive/v3/files" ) ;
858881 assert_eq ! ( result, Some ( ( "google-drive" , "Google Drive" ) ) ) ;
882+
883+ let result = provider_for_host_and_path ( "www.googleapis.com" , "/youtube/v3/playlists" ) ;
884+ assert_eq ! ( result, Some ( ( "youtube" , "YouTube" ) ) ) ;
859885 }
860886
861887 #[ test]
0 commit comments