Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
package com.github.scribejava.apis;

import com.github.scribejava.core.builder.api.DefaultApi20;
import com.github.scribejava.core.model.OAuthConstants;
import com.github.scribejava.core.model.ParameterList;
import com.github.scribejava.core.model.Verb;
import com.github.scribejava.core.oauth2.clientauthentication.ClientAuthentication;
import com.github.scribejava.core.oauth2.clientauthentication.RequestBodyAuthenticationScheme;
import java.util.Map;

public class DoktornaraboteApi extends DefaultApi20 {

private static final String REDIRECT_PARAM_NAME = "redirect";

protected DoktornaraboteApi() {
}

Expand All @@ -17,11 +25,44 @@ public static DoktornaraboteApi instance() {

@Override
public String getAccessTokenEndpoint() {
return "https://auth.doktornarabote.ru/OAuth/Token";
return "https://id.doktornarabote.ru/api/v1/auth/token";
}

@Override
public Verb getAccessTokenVerb() {
return Verb.GET;
}

@Override
protected String getAuthorizationBaseUrl() {
return "https://auth.doktornarabote.ru/OAuth/Authorize";
return "https://www.doktornarabote.ru";
}

@Override
public ClientAuthentication getClientAuthentication() {
return RequestBodyAuthenticationScheme.instance();
}

@Override
public String getAuthorizationUrl(String responseType, String apiKey, String callback, String scope, String state,
Map<String, String> additionalParams) {
final ParameterList parameters = new ParameterList(additionalParams);
parameters.add(OAuthConstants.RESPONSE_TYPE, responseType);
parameters.add(OAuthConstants.CLIENT_ID, apiKey);

if (callback != null) {
parameters.add(REDIRECT_PARAM_NAME, callback);
}

if (scope != null) {
parameters.add(OAuthConstants.SCOPE, scope);
}

if (state != null) {
parameters.add(OAuthConstants.STATE, state);
}

return parameters.appendTo(getAuthorizationBaseUrl());
}

}