Skip to main content

๐Ÿ”’๏ธ Authentication

GreenCloud has built in Authentication from the ground up. From the early days we realised that security is a big part of a cloud system. As such we use industry strength encryption and STRONGLY encourage our users to use 2FA which dramatically reduces the chances of an attack on an account.

Requirements

The first thing you will need to do is to Register an account.

Registerโ€‹

info

Use this endpoint to register an account with GreenCloud. The succesful response is an HTTP 201 response. An email will be sent to the email address used, enabling them to complete the registration of their account.

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/register
https://api.greencloud.dev/v1/auth/register

Request Headersโ€‹

KeyValueRequired
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyExampleRequirements
nameRichardrequired min=8
surnameHillrequired alpha max=20
email
[email protected]
required
passwordHello123!required min=8 max=128 containsany=0-9 containsany=!@#$%&*

Example Requestโ€‹

{
"name": "Richard",
"surname": "Hill",
"email": "[email protected]",
"password":"Hello123!",
}

Example Responseโ€‹

Status: 201 Created
Empty body

Activateโ€‹

info

After successful registration using the Register endpoint, the user will receive an email containing an activation link to activate their account. The activation link will include a unique system-generated code that needs to be passed to the Account Activation endpoint.

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/activate
https://api.greencloud.dev/v1/auth/activate

Request Headersโ€‹

KeyValueRequired
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyExampleRequirements
codeea6bdeeb005a4a80a43c444b8828ca4arequired

Example Requestโ€‹

{
"code": "ea6bdeeb005a4a80a43c444b8828ca4a"
}

Example Responseโ€‹

Status: 200 OK
Empty body

Loginโ€‹

info

After successfully registering an account, users can now log in to their account. Upon successful login, the endpoint will return an access and refresh token.

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/login
https://api.greencloud.dev/v1/auth/login

Request Headersโ€‹

KeyValueRequired
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyExampleRequirements
email
[email protected]
required
passwordHello123!required min=8 containsany=!@#$%&*
twofa123456required when 2FA is enabled

Example Requestโ€‹

{
"email": "[email protected]",
"password":"Hello123!",
"twofa":"123456"
}

Example Responseโ€‹

Status: 200 OK
{
"expiresIn": 3590,
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2Nzc5MjU4NjQsImlhdCI6MTY3NzkyMjI2NCwiaXNzIjoiZ3JlZW5jbG91bmQuZGV2IiwianRpIjoiZDk5NTYyODctMzA3Ni00NjgwLWExMGMtZjRjYzhjMmJmYzJhIiwidXNlcklkIjoiNjNlZDFiNGY0MDVkOGE0NGJkYzQyYzE5In0.hXJWTDgjADXCgceXqIdiBsGxik_EAXj1u2KBdvdlk755OuCq_f7TS5N4Eaf3Qym0QEfxFaZA-mhGn--BZJoNOZ1z2kAYihUrnk4kyNhfDxfqLPJ_ZUoyrqFSZfdrCrXYojxTkk_0q47MCgQgbDWXIb8V8M3AJpyOwBA4Ju24WdleOoPBKWA-1TlxcZrCbGQKtHS8pmAeoFX-iwHbd2vOucGOto7_6A9_FUtmAR5JHP9zRUUDLgGU9R1To5UHkqIJrHVh_kd2KULw0wLLdPr2QSklIQcrLPBQdlKygq34VP99rmL5_bYSBFVnZ54YZAsfLoGuHGV0hv59GwH0vRLaCA",
"refreshToken": "40d6b6a52256ee2b6f52645bbf5d90d0a4011d341b4fda69a1bed448f3fddfa4c0f019fc4e58ed39d6b377b909df95310bc43a2d07654327eca9ae2d96f69b72319cc825601bfc40c1a19600bce5a719086e83b69f89caca131f8d9d969c866b661ddc2ee687a43b3acd9e8bfe310aac7c78401bc504b8fda9756563d9e5f11c2ca2161119084b2d0eb62f50fbab2c928800d2c8027f64f45b1a1895165e21f67ce95fd262568c304836d29ae06f035bf131b161ad05612fed7132ceee528e9d9f5543b75cba410a22f867633347b13e596254bdf76cddd4bbb8fa83ecf1cd15dfd972fee088844ffaada3c2053b72265dea4da0b7cc24ea0a552114f73d9a5b"
}

Refresh Tokenโ€‹

info

After successful login, the user receives an Access Token and a Refresh Token. The Access Token is valid for 90 days, after which the user needs to refresh it using the Refresh Token.

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/refresh
https://api.greencloud.dev/v1/auth/refresh

Request Headersโ€‹

KeyValueRequired
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyValueRequirements
refreshTokenvalid refresh tokenrequired

Example Requestโ€‹

{
"refreshToken": "40d6b6a52256ee2b6f52645bbf5d90d0a4011d341b4fda69a1bed448f3fddfa4c0f019fc4e58ed39d6b377b909df95310bc43a2d07654327eca9ae2d96f69b72319cc825601bfc40c1a19600bce5a719086e83b69f89caca131f8d9d969c866b661ddc2ee687a43b3acd9e8bfe310aac7c78401bc504b8fda9756563d9e5f11c2ca2161119084b2d0eb62f50fbab2c928800d2c8027f64f45b1a1895165e21f67ce95fd262568c304836d29ae06f035bf131b161ad05612fed7132ceee528e9d9f5543b75cba410a22f867633347b13e596254bdf76cddd4bbb8fa83ecf1cd15dfd972fee088844ffaada3c2053b72265dea4da0b7cc24ea0a552114f73d9a5b",
}

Example Responseโ€‹

Status: 200 OK
{
"expiresIn": 3590,
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2Nzc5Mzc5OTQsImlhdCI6MTY3NzkzNDM5NCwiaXNzIjoiZ3JlZW5jbG91bmQuZGV2IiwianRpIjoiYjM3YzI5MDktMjI0ZS00Yjk1LTkzZDktNTZhZjc2ZmIxM2JiIiwidXNlcklkIjoiNjNlZDFiNGY0MDVkOGE0NGJkYzQyYzE5In0.TUO7BukLKHKc8KfeQFU_I7K1vjihCEkVljRGQt6EwRj8i6PC3MjwsLl65xopxEj7GfDhUkdzF_J80TSKm9gmqGBl9DGfVcT1Iy9IjbKrd2SXkZ6eiztxOjWWtDHEfDHA4svkRr49fpWJrzfu4mL8Mpvr5eKn_AJ1wZ-z8kQRBy06im3NWxCAKZW4vXsWdilxqcj_XLT68itABMHwt-nI6Grj0X8fpGDGfIMu2khEjpc6G9qv1eG7vWXtCPowO780YigU8soOTAzAsc1hz01TzUFPme_zObA_6wL_lKHg0peeDK6mW1qessUWrozGnpRupv7Y4BRjX1Df21rVKS9n8Q",
"refreshToken": "b5530e625c440cffc473c04a7a960bb1e36ab29563ec8b7c9fd2efddf41c793b9ec2cb16056063adcf5edd7ccefafcf473c93b8abf44300e02f61cbf710f6d839830c280b63bf7c59bc7e0d7cb286293953f689becd1e3bf996140bf1482da2f76d52f2a3deebac5e1c3595706e934619e7b8b04f491c4838c7b96e128593874e12d4c283c0a6d717edfa3483be1277c6dc8cb0eace7c04fb45f5eb35b1800d8c948a6955516051e12ca49943ae7d61d6d0bf6a2a1a61da0f45e19b084408b0f471cc668aa406a46db74a6c54383e3696bc7cf14be5fbfc5e9caf1d7054a94a1821a1317e1b80258eba94fb1b53806ee0f37f2c6ddfc8e24f626665d18275a5d"
}

API KEYโ€‹

info

To use the Command Line Interface (CLI), users need to obtain their API key. The API key is required when logging into the CLI tool for the first time. It is this endpoint that allows that. Users can also obtain their API key from their GreenCloud web site dashboard.

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/apiKey
https://api.greencloud.dev/v1/auth/apiKey

Request Headersโ€‹

KeyValueRequired
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyExampleRequirements
key92c85d5c-dcea-447d-9eac-0d6d64d8b340required

Example Requestโ€‹

{
"key": "92c85d5c-dcea-447d-9eac-0d6d64d8b340"
}

Example Responseโ€‹

{
"expiresIn": 3590,
"accessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2Nzc5Mzg4MTMsImlhdCI6MTY3NzkzNTIxMywiaXNzIjoiZ3JlZW5jbG91bmQuZGV2IiwianRpIjoiYjUyOTMyOWUtZmJiOS00OTU5LTg1YTMtNTMxMTE1ZTY4MTJkIiwidXNlcklkIjoiNjNlZDFiNGY0MDVkOGE0NGJkYzQyYzE5In0.f6sYvMh5AKd0G7UnSojkE9G6PVTlFndtaGZ30EXhGoXgYf4ysZleX2Dx6YxFFVhKDVabg2QjmnprRgJbTxSqffRi0es2BkfnuX5T-iQqI5iHqF3D0x0EfK5bn0NxrkRVg6CddrOHfz8E5kvtDmXFNCgrLGD1jw_USTBzxry6U3mZNQ7CRMKPTozOQQU1q5DZZgEZ_mMOERcuTj_LA5XOPtrKWOFhs407l8isfrKY_CjVg2XHmfH3tXzjDtlyrAHgiJC09T_QgHlTHezv8RWkp0KFN5BARDWP56asthT-9_FGZBPA-N1QxXF6GWu86ZPJZfC2KS0Z2tolCFvQE8ySzg"
}

2FA - ( Two Factor Authentication )โ€‹

info

GreenCloud take security VERY seriously. To ensure the highest level of security, we make use of Two Factor Authentication (2FA) and strongly recommend that all users enable it on their accounts to keep their accounts from being compromised by malicious actors.

Users who have enabled 2FA will need to pass the 6-digit code from their 2FA app to this endpoint. If you are not familiar with 2FA, please refer to this resource to understand it: What is 2FA

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/2FA
https://api.greencloud.dev/v1/auth/2FA

Request Headersโ€‹

KeyValueRequired
AuthorizationValid Access Tokentrue

Example Requestโ€‹

Empty body

Example Responseโ€‹

Status: 200 OK
{
"seed": "PDMIY2255L4EKRUI5UWNSYHVZ22X5OM5"
}

Active 2FAโ€‹

info

When the user starts their account they will not have activated 2FA support. We call this endpoint to enable 2FA support. To use it we pass in a test code to sync with from an auth app. By default, when a user starts their account, 2FA support will not be enabled. To enable 2FA support, the user can call this endpoint. At this step, we verify the code to sync with their 2FA app.

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/verify2FA
https://api.greencloud.dev/v1/auth/verify2FA

Request Headersโ€‹

KeyValueRequired
AuthorizationValid Access Tokentrue
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyExampleRequirements
code069303required

Example Requestโ€‹

{
"code": "069303"
}

Example Responseโ€‹

Status: 200 OK
Empty body

Disable 2FAโ€‹

info

To disable 2FA support on your GreenCloud account, you can call this endpoint. You will be required to provide the currently active 2FA value from your authenticator app. To re-enable 2FA support - which we strongly recommend - simply call the api/auth/verify2FA endpoint.

Endpointโ€‹

DELETE
https://api.greencloud.dev/v1/auth/2FA
https://api.greencloud.dev/v1/auth/2FA

Request Headersโ€‹

KeyValueRequired
AuthorizationValid Access Tokentrue
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyExampleRequirements
code069303required

Example Requestโ€‹

{
"code": "069303"
}

Example Responseโ€‹

Status: 204 No Content
Empty body

Nodeโ€‹

info

To authorize a node within the GreenCloud ecosystem, you can use this endpoint.

Endpointโ€‹

POST
https://api.greencloud.dev/v1/auth/node
https://api.greencloud.dev/v1/auth/node

Request Headersโ€‹

KeyValueRequired
Content-Typeapplication/jsontrue

Request Bodyโ€‹

KeyExampleRequirements
codenode idrequired

Example Requestโ€‹

{
"id": "1a061cfd-df01-4b02-a067-5122c5941e15"
}

Example Responseโ€‹

Status: 200 OK
Empty body