Base64 encode string

Is there any way to encode username + password to base64 encoded string?

I have a gut feeling that this may be a bad idea for security
Can you elaborate on your code, language and what you are trying to do

It is Amazon M2M integration where I cambine client_id and client_secret to make a post call, the response is only a validation token and approval url so nothing goes further if the end user does not approve the whole thing. and the language is motoko backend.
and it goes HTTPS header so it is encrypted during during transport layer.