'Authorization Header and Base64 Encoding in VimeoAPI

I am new to the world of APIs and Auth, and would certainly appreciate any help. I am attempting to authorize and receive a token through the Vimeo API (OAuth2). My question is how to properly set the value of the Authorization Header. (Table below from: https://developer.vimeo.com/api/authentication)

Header Set value to
Authorization basic base64_encode(x:y), where x is the client identifier and y is the client secret

In this table is base64_encode plain text that I need to write, or does this denote a function I need to use in my language that converts x:y into Base64? M Language, in my case.

Also, are my clientID and clientSecret ready to put into the header "as-is" or do they themselves need to be converted into Base64 before being used as auth for the token endpoint?

The gist of my confusion is how exactly I should write the authorization header, because I keep getting the error "[invalid_client] A valid client ID must be provided along with any request made to Vimeo's API" when trying to POST to the token endpoint.

Thank you for any help!



Solution 1:[1]

The idea that you should use some sort of function to encode your clientID and secret is correct.

If you are using javascript the code might looks something like this

const clientId = 'client_id';
const clientSecret = 'client_secret';

// btoa() is a javascript built-in that base64 encodes a string
const authorizationValue = 'Basic ' + btoa( clientId + ':' + clientSecret );

You can read more about btoa() on Mozilla's documentation website. https://developer.mozilla.org/en-US/docs/Web/API/btoa

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 etchesketch