@@ -41,19 +41,25 @@ public AuthService(IJSRuntime jsRuntime, IHttpClientFactory httpClientFactory, I
4141 /// <returns></returns>
4242 public async Task RequestAuthorizationCode ( string clientId , List < Scope > scopes , string redirectUrl , PromptType promptType = PromptType . Consent )
4343 {
44- string encodedRedirectUrl = HttpUtility . UrlEncode ( redirectUrl ) ;
4544 if ( scopes == null || scopes . Count == 0 )
4645 {
4746 return ;
4847 }
49- List < string > scopeStringList = new List < string > ( ) ;
50- foreach ( var scope in scopes )
51- {
52- scopeStringList . Add ( scope . ToDescriptionString ( ) ) ;
53- }
54- string scopeString = string . Join ( "+" , scopeStringList ) ;
5548
56- await JSRuntime . InvokeVoidAsync ( "open" , $ "https://accounts.google.com/o/oauth2/auth/oauthchooseaccount?response_type=code&client_id={ clientId } &scope={ scopeString } &redirect_uri={ encodedRedirectUrl } &flowName=GeneralOAuthFlow&access_type=offline&prompt={ promptType . ToDescriptionString ( ) } ", "_blank" ) ;
49+ string encodedRedirectUrl = HttpUtility . UrlEncode ( redirectUrl ) ;
50+
51+ string encodedScopes = HttpUtility . UrlEncode ( string . Join ( " " , scopes . Select ( x => x . ToDescriptionString ( ) ) ) ) ;
52+
53+ string url =
54+ $ "https://accounts.google.com/o/oauth2/v2/auth" +
55+ $ "?response_type=code" +
56+ $ "&client_id={ clientId } " +
57+ $ "&scope={ encodedScopes } " +
58+ $ "&redirect_uri={ encodedRedirectUrl } " +
59+ $ "&access_type=offline" +
60+ $ "&prompt={ promptType . ToDescriptionString ( ) } ";
61+
62+ await JSRuntime . InvokeVoidAsync ( "open" , url , "_blank" ) ;
5763 }
5864
5965 /// <summary>
0 commit comments