Question: Best way to change URL to Request or Access Token EndPoint? #369

Closed
artofbi opened this Issue Mar 28, 2013 · 2 comments

Projects

None yet

2 participants

@artofbi
artofbi commented Mar 28, 2013

I haven't seen this addressed, but if using Scribe to connect to Oauth API having multiple endpoints such as: sandbox, test, production, What would be the best way to declare this logic dynamically in the existing code or how could we extend this? Or, does this exist and I'am simply missing something?

An example would be the GoogleApi class org.scribe.builder.api.GoogleApi.java, the following assessor is hard coded:

@Override
 public String getRequestTokenEndpoint()
  {
    return "https://www.google.com/accounts/OAuthGetRequestToken";
  }

If Google, had a sandbox for testing, like a few other vendors do, what would be the best way from the code implementation to switch to, for example, https://sandbox.google.com/accounts/OAuthGetRequestToken
?

Could we get to something like the below snippet where I've injected .requestToken("sandbox")?

OAuthService service = new ServiceBuilder()
                                  .provider(GoogleApi.class).requestToken("sandbox")
                                  .apiKey("anonymous")
                                  .apiSecret("anonymous")
                                  .scope(SCOPE)
                                  .build();

Thanks in advance.

@fernandezpablo85
Collaborator

just noticed that indentation on that class is fucked as fuck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment