All Downloads are FREE. Search and download functionalities are using the official Maven repository.

se.michaelthelin.spotify.requests.authorization.AbstractAuthorizationRequest Maven / Gradle / Ivy

There is a newer version: 9.0.0-RC1
Show newest version
package se.michaelthelin.spotify.requests.authorization;

import se.michaelthelin.spotify.Base64;
import se.michaelthelin.spotify.requests.AbstractRequest;

public abstract class AbstractAuthorizationRequest extends AbstractRequest {
  protected AbstractAuthorizationRequest(final Builder builder) {
    super(builder);
  }

  public static abstract class Builder> extends AbstractRequest.Builder {
    protected Builder(final String clientId, final String clientSecret) {
      super();

      assert (clientId != null);
      assert (clientSecret != null);
      assert (!clientId.equals(""));
      assert (!clientSecret.equals(""));

      setHeader("Authorization", "Basic " + Base64.encode((clientId + ":" + clientSecret).getBytes()));
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy