Skip to main content

Custom OAuth Integration Guide for WarmUpInbox

Written by Lucia MatΓΊΕ‘kovΓ‘
Updated over 8 months ago

This guide explains how to set up Gmail or Microsoft Outlook inboxes using your own OAuth applications instead of WarmUpInbox's shared OAuth credentials.

🎯 Why Use Custom OAuth Integration?

  • Enterprise Control: Utilize your own verified OAuth applications.

  • Enhanced Security: Ideal for organizations with specific security needs.

  • Bypass Verification Issues: Avoid reliance on WarmUpInbox's OAuth verification status.

πŸ“‹ Prerequisites

  • Active WarmUpInbox account with API access.

  • Administrative access to Google Cloud Console or Microsoft Azure.

  • Basic understanding of OAuth 2.0 concepts.

  • API client (Postman, curl, or custom application).

πŸ”΅ Google Gmail Integration


Step 1: Create a Google Cloud Project

  1. Click "Select a project" β†’ "New Project".

  2. Enter the project name (e.g., "WarmUpInbox Integration").

  3. Click "Create".

Step 2: Enable Gmail API

  1. In your project, go to "APIs & Services" β†’ "Library".

  2. Search for "Gmail API".

  3. Click on it and press "Enable".

Step 3: Configure OAuth Consent Screen

  1. Go to "APIs & Services" β†’ "OAuth consent screen".

  2. Choose "External" (if you don’t have Google Workspace).

  3. Fill in the required fields:

    • App name: Your application name.

    • User support email: Your email.

    • Developer contact information: Your email.

  4. Click "Save and Continue".

Step 4: Add Required Scopes

  1. Click "Add or Remove Scopes".

  2. Add these essential scopes:

  3. Click "Update" β†’ "Save and Continue".

Step 5: Create OAuth Credentials

  1. Go to "APIs & Services" β†’ "Credentials".

  2. Click "Create Credentials" β†’ "OAuth 2.0 Client IDs".

  3. Choose "Web application".

  4. Add redirect URI: http://localhost:8080 (or your preferred URL).

  5. Click "Create".

  6. Save the Client ID and Client Secret – you'll need these!

Step 6: Get Access and Refresh Tokens

Create the authorization URL:

https://accounts.google.com/o/oauth2/auth?
client_id=YOUR_CLIENT_ID&
redirect_uri=http://localhost:8080&
scope=https://www.googleapis.com/auth/gmail.readonly%20https://www.googleapis.com/auth/gmail.send%20https://www.googleapis.com/auth/gmail.modify&
response_type=code&
access_type=offline&
prompt=consent
  1. Replace YOUR_CLIENT_ID with your actual client ID.

  2. Open this URL in a browser and authorize your Gmail account.

  3. Copy the code parameter from the redirect URL.

  4. Exchange the code for tokens:

curl -X POST https://oauth2.googleapis.com/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET" \
-d "code=YOUR_AUTHORIZATION_CODE" \
-d "grant_type=authorization_code" \
-d "redirect_uri=http://localhost:8080"

Save the access_token and refresh_token from the response.

Step 7: Create Inbox via WarmUpInbox API

curl -X POST https://api.warmupinbox.com/v2/inboxes/advanced \
-H "Authorization: Bearer YOUR_WARMUPINBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"sender_first": "Your",
"sender_last": "Name",
"plan": "basic",
"custom_oauth": {
"client_id": "YOUR_GOOGLE_CLIENT_ID",
"secret_id": "YOUR_GOOGLE_CLIENT_SECRET"
},
"google": {
"access_token": "YOUR_ACCESS_TOKEN",
"refresh_token": "YOUR_REFRESH_TOKEN"
},
"frequency": {
"starting_baseline": 4,
"increase_per_day": 4,
"max_sends_per_day": 50,
"reply_rate": 30
}
}'

πŸ”· Microsoft Outlook Integration

Step 1: Register Application in Azure

  1. Navigate to "Azure Active Directory" β†’ "App registrations".

  2. Click "New registration".

  3. Fill in details:

    • Name: Your application name.

    • Supported account types: Choose the appropriate option.

    • Redirect URI: http://localhost:8080 (Web).

  4. Click "Register".

Step 2: Configure API Permissions

  1. In your app, go to "API permissions".

  2. Click "Add a permission" β†’ "Microsoft Graph".

  3. Choose "Delegated permissions".

  4. Add these essential permissions:

Mail.ReadWrite
Mail.Send
MailboxSettings.ReadWrite
User.Read
email
openid
profile

5. Click "Add permissions".

6. Click "Grant admin consent" (if you're an admin).

Step 3: Create Client Secret

  1. Go to "Certificates & secrets".

  2. Click "New client secret".

  3. Add a description and choose expiration.

  4. Click "Add".

  5. Copy the secret value immediately – it won’t show again!

Step 4: Get Authorization Code

  1. Create the authorization URL:

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?
client_id=YOUR_CLIENT_ID&
response_type=code&
redirect_uri=http://localhost:8080&
response_mode=query&
scope=https://graph.microsoft.com/Mail.ReadWrite%20https://graph.microsoft.com/Mail.Send%20https://graph.microsoft.com/MailboxSettings.ReadWrite%20https://graph.microsoft.com/User.Read%20email%20openid%20profile&
prompt=consent

2. Replace YOUR_CLIENT_ID and open the URL in a browser.

3. Authorize and copy the code from the redirect URL.

Step 5: Get Token Cache

This is the complex part. Use Microsoft's MSAL library to generate the token cache. Here’s a Node.js example:

const msal = require("@azure/msal-node");

const clientConfig = {
auth: {
clientId: "YOUR_CLIENT_ID",
clientSecret: "YOUR_CLIENT_SECRET",
authority: "https://login.microsoftonline.com/common",
},
};

const pca = new msal.ConfidentialClientApplication(clientConfig);

const tokenRequest = {
code: "YOUR_AUTHORIZATION_CODE",
scopes: [
"https://graph.microsoft.com/Mail.ReadWrite",
"https://graph.microsoft.com/Mail.Send",
],
redirectUri: "http://localhost:8080",
};

pca
.acquireTokenByCode(tokenRequest)
.then((response) => {
// Get the token cache
const tokenCache = pca.getTokenCache().serialize();
console.log("Token Cache:", tokenCache);
})
.catch((error) => {
console.log(error);
});

Step 6: Create Inbox via WarmUpInbox API

curl -X POST https://api.warmupinbox.com/v2/inboxes/advanced \
-H "Authorization: Bearer YOUR_WARMUPINBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "[email protected]",
"sender_first": "Your",
"sender_last": "Name",
"plan": "basic",
"custom_oauth": {
"client_id": "YOUR_MICROSOFT_CLIENT_ID",
"secret_id": "YOUR_MICROSOFT_CLIENT_SECRET"
},
"office": {
"token_cache": "YOUR_SERIALIZED_TOKEN_CACHE_JSON_STRING"
},
"frequency": {
"starting_baseline": 4,
"increase_per_day": 4,
"max_sends_per_day": 50,
"reply_rate": 30
}
}'

Common Issues and Solutions

Google Issues

Problem: "Access blocked: This app's request is invalid"

  • Solution: Ensure all required scopes are added and the consent screen is properly configured.

Problem: "invalid_grant" error

  • Solution: Make sure you're using access_type=offline and prompt=consent in the authorization URL.

Problem: "insufficient_scope" error

  • Solution: Verify that you've added all three required Gmail scopes.

Microsoft Issues

Problem: "AADSTS65001: The user or administrator has not consented"

  • Solution: Ensure admin consent is granted for all required permissions.

Problem: "invalid_client" error

  • Solution: Double-check that the client ID and secret are correct.

Problem: Token cache format issues

  • Solution: Ensure you're using the MSAL library to generate the proper token cache format.

General Issues

Problem: 401 Unauthorized from WarmUpInbox API

  • Solution: Verify that your WarmUpInbox API key is correct and has the proper permissions.

Problem: 400 Bad Request - missing fields

  • Solution: Ensure you're providing both custom_oauth AND either google or office configurations.

πŸ”’ Security Best Practices

  1. Store credentials securely: Never expose client secrets in client-side code.

  2. Use HTTPS: Always use HTTPS in production redirect URIs.

  3. Limit scopes: Only request the minimum required permissions.

  4. Monitor usage: Regularly check OAuth application usage in cloud consoles.

πŸ“ž Support

If you encounter issues:

  1. Verify all required scopes are properly configured.

  2. Check that both credentials AND tokens are provided in the API call.

  3. Ensure your OAuth application has proper permissions in Google/Microsoft.

  4. For Google integrations: Remember that you typically need less verification for internal apps.

  5. Contact WarmUpInbox support with specific error messages if problems persist.

πŸŽ‰ Success!

Once configured properly, your custom OAuth integration will:

- βœ… Bypass WarmUpInbox's OAuth verification limitations

- βœ… Provide enhanced security and control

- βœ… Work seamlessly with WarmUpInbox's warmup system

Your inbox will now be ready for email warmup using your own OAuth credentials!

Did this answer your question?