Created
April 20, 2023 10:07
-
-
Save aartajew/c2efffa4f872ba95b364701fe64471bf to your computer and use it in GitHub Desktop.
Scala > Build OAuth2 basic header
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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