OAuth2 connection platform.sh

I’d like to connect to platform.sh API. Unfortunately i fail with authentication already. There is no prebuilt module, so i need to go with HTTP module. What is did so far:

Response is:

error: invalid_request
error_description: The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Client credentials missing or malformed in both HTTP Authorization header and HTTP POST body.

Sources are Platform.sh API Documentation and https://www.make.com/en/help/tutorials/adding-an-oauth-2-0-connection-with-the-client-credentials-grant-type-via-http

This is working for me on a console, how do i translate in make.com?

curl -u platform-api-user: \
    -d 'grant_type=api_token&api_token=API_TOKEN' \
    https://auth.api.platform.sh/oauth2/token

Thank you in advance.

Best Daniel

I would be really happy to get a push in the right direction. thank you very and much in advance.

Hi @DanHH
Why dont you use the pre built 2.0 auth http module?

https://www.make.com/en/help/tools/http#:~:text=make%20an%20oauth%202.0%20request%3A%20for%20resources%20that%20require%20oauth%202.0%20authorization.

2 Likes

Hi @Dorian_Ben_Haim , thx for your feedback!

Reason i don’t use this is: I only have this description about how to authenticate to p.sh Platform.sh API Documentation

And when i use the default OAuth2 Module from HTTP and add a new connection, i need to fill in fields that are not mentioned there and i don’t know them:

Flow type, Authorize URI, Token URI, Scope, Client ID, Client Secret

Any idea what to add there?

I solved it now by doing this, maybe interesting for others as well:
1.) HTTP Module with POST request to Platform.sh authentication and two fields
Key: grant_type Value: api_token
Key: api_token Value: MY_TOKEN
Body type: Application/x-www-form-urlencoded

With this reuqest i get the Bearer token in the response

2.) With this Bear token, i do a second HTTP GET request to the actual API like
https://api.platform.sh/my_needed_request_here with Header
Name: Authorization
Value: Bearer BEARER_TOKEN

It works now…

3 Likes