@@ -81,17 +81,31 @@ public Task<MastodonInstance> Instance()
8181 return this . Connection . GetAsync < MastodonInstance > ( endpoint , null ) ;
8282 }
8383
84- public async Task < MastodonAccessToken > OAuthToken ( string clientId , string clientSecret , string grantType ,
85- string username , string password , string scope = null )
84+ public Uri OAuthAuthorize ( string clientId , string responseType , Uri redirectUri , string scope )
85+ {
86+ var endpoint = new Uri ( "/oauth/authorize" , UriKind . Relative ) ;
87+ var param = new Dictionary < string , string >
88+ {
89+ [ "client_id" ] = clientId ,
90+ [ "response_type" ] = responseType ,
91+ [ "redirect_uri" ] = redirectUri . AbsoluteUri ,
92+ [ "scope" ] = scope ,
93+ } ;
94+
95+ return new Uri ( new Uri ( this . InstanceUri , endpoint ) , "?" + MyCommon . BuildQueryString ( param ) ) ;
96+ }
97+
98+ public async Task < MastodonAccessToken > OAuthToken ( string clientId , string clientSecret , Uri redirectUri ,
99+ string grantType , string code , string scope = null )
86100 {
87101 var endpoint = new Uri ( "/oauth/token" , UriKind . Relative ) ;
88102 var param = new Dictionary < string , string >
89103 {
90104 [ "client_id" ] = clientId ,
91105 [ "client_secret" ] = clientSecret ,
106+ [ "redirect_uri" ] = redirectUri . AbsoluteUri ,
92107 [ "grant_type" ] = grantType ,
93- [ "username" ] = username ,
94- [ "password" ] = password ,
108+ [ "code" ] = code ,
95109 } ;
96110
97111 if ( scope != null )
0 commit comments