User Based Authentication Guide
This guide will explain how to use the Buildr API to authenticate and authorize your application using the Authorization Code grant type.
Authorization Code Grant Type
The Authorization Code grant type is a secure and widely-used method of authorization that requires the user to explicitly grant access to your application.
Scopes
Buildr uses scopes to control access to different parts of the API. The two available scopes for the Client Credentials grant type are read and write. If you want to read and write, you need to request both scopes.
read
Allows read access to the Buildr API.write
Allows write access to the Buildr API.
Request Flow
-
Redirect the user to the Buildr
/oauth/authorize
endpoint with the following query parameters:response_type=code
client_id=your_client_id
redirect_uri=https://yourapp.com/redirect_uri
scope=read write
Example:
-
The user will be prompted to authorize your application to access their Buildr data.
-
If the user approves your application, they will be redirected to your redirect URI with an authorization code as a query parameter. Example:
Access Token Request
-
Your application should make a POST request to the Buildr
/oauth/token
endpoint with the following request body: -
Buildr will respond with a JSON object containing an access token, a refresh token, and information about the token’s expiration time. Example response:
Refreshing Access Tokens
Access tokens have a limited lifespan and will eventually expire. When this happens, your application must obtain a new access token using a refresh token.
To refresh an access token, make a POST request to the Buildr /oauth/token
endpoint with the following request body:
Buildr will respond with a new access token and refresh token, as well as information about the token’s expiration time. Example response:
Conclusion
Congratulations! You have successfully authenticated and authorized your application with the Buildr API using the Authorization Code grant type. You can now use the access token to make requests to the Buildr API on behalf of the user.
Please note that these are just examples and the actual responses may differ depending on your Buildr integration configuration.