File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
main/java/com/github/scribejava/apis
test/java/com/github/scribejava/apis/examples Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 44import com .github .scribejava .core .extractors .AccessTokenExtractor ;
55import com .github .scribejava .core .extractors .JsonTokenExtractor ;
66import com .github .scribejava .core .model .OAuthConfig ;
7- import com .github .scribejava .core .model .OAuthConstants ;
87import com .github .scribejava .core .model .Verb ;
98
109import com .github .scribejava .apis .service .HHOAuthServiceImpl ;
1110import com .github .scribejava .core .oauth .OAuth20Service ;
11+ import com .github .scribejava .core .utils .OAuthEncoder ;
1212
1313public class HHApi extends DefaultApi20 {
1414
15- private static final String AUTHORIZE_URL = "https://m.hh.ru/oauth/authorize?response_type=code&client_id=%s" ;
16- private static final String TOKEN_URL = "https://m.hh.ru/oauth/token?grant_type="
17- + OAuthConstants .AUTHORIZATION_CODE ;
15+ private static final String AUTHORIZE_URL = "https://hh.ru/oauth/authorize?response_type=code&" +
16+ "client_id=%s&redirect_uri=%s" ;
17+
18+ private static final String TOKEN_URL = "https://hh.ru/oauth/token" ;
1819
1920 private HHApi () {
2021 }
@@ -39,7 +40,7 @@ public String getAccessTokenEndpoint() {
3940
4041 @ Override
4142 public String getAuthorizationUrl (OAuthConfig config ) {
42- return String .format (AUTHORIZE_URL , config .getApiKey ());
43+ return String .format (AUTHORIZE_URL , config .getApiKey (), OAuthEncoder . encode ( config . getCallback ()) );
4344 }
4445
4546 @ Override
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ public static void main(String... args) {
2525 .apiKey (clientId )
2626 .apiSecret (clientSecret )
2727 .callback ("http://your.site.com/callback" )
28+ .grantType ("authorization_code" )
2829 .build (HHApi .instance ());
2930 final Scanner in = new Scanner (System .in );
3031
You can’t perform that action at this time.
0 commit comments