File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ async function handleMessage(
100
100
context . globalState . update ( "courseId" , courseId ) ;
101
101
treeDataProvider . refresh ( ) ;
102
102
break ;
103
+ case MessageTypeNames . LoginWithBrowser :
104
+ const { route } = message ;
105
+ vscode . env . openExternal ( vscode . Uri . parse ( route ) ) ;
103
106
}
104
107
console . log ( `${ Date . now ( ) } Finish handleMessage: ${ message . type } ` ) ;
105
108
}
Original file line number Diff line number Diff line change @@ -51,6 +51,20 @@ export function activate(context: vscode.ExtensionContext) {
51
51
"*.js" : "source" ,
52
52
} ) ;
53
53
}
54
+
55
+ vscode . window . registerUriHandler ( {
56
+ handleUri ( uri : vscode . Uri ) {
57
+ const searchParams = new URLSearchParams ( uri . query ) ;
58
+ // The following two params are available when logging in via OAuth providers
59
+ const code = searchParams . get ( "code" ) ;
60
+ const clientRequestId = searchParams . get ( "client-request-id" ) ;
61
+
62
+ vscode . commands . executeCommand (
63
+ "source-academy.show-panel" ,
64
+ `/login/vscode_callback?code=${ code } &client-request-id=${ clientRequestId } ` ,
65
+ ) ;
66
+ } ,
67
+ } ) ;
54
68
}
55
69
56
70
// This method is called when your extension is deactivated
Original file line number Diff line number Diff line change @@ -58,6 +58,9 @@ const Messages = createMessages({
58
58
Navigate : ( route : string ) => ( {
59
59
route,
60
60
} ) ,
61
+ LoginWithBrowser : ( route : string ) => ( {
62
+ route,
63
+ } ) ,
61
64
} ) ;
62
65
63
66
export default Messages ;
You can’t perform that action at this time.
0 commit comments