Skip to content

Instantly share code, notes, and snippets.

@aartajew
Created April 20, 2023 10:07
Show Gist options
  • Save aartajew/c2efffa4f872ba95b364701fe64471bf to your computer and use it in GitHub Desktop.
Save aartajew/c2efffa4f872ba95b364701fe64471bf to your computer and use it in GitHub Desktop.
Scala > Build OAuth2 basic header
package util
import java.nio.charset._
import java.util._
object OAuth2BasicHeader {
def apply(key: String, secret: String) = {
val bytes = s"$key:$secret".getBytes(StandardCharsets.UTF_8)
"Basic " + Base64.getEncoder.encodeToString(bytes)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment