Skip to main content

Trying Outh to PHP platform though Calendly API

After enter my gmail and pw and then get the gmail account notification, it redirect me to :

https://calendly.com/oauth/authorize?client_id=rfk868EyM50ys6nNAlvG29AEc0iI-vD5ArhF2k4XH4E&response_type=code&redirect_uri=https://zix-technologie.com/zix-calendar/sirine993-synchronisation/calendly_callback.php&scope=users:read%20events:read%20event_types:read%20scheduling_links:read

with the error

 



My auth_calendly.php looks like this :

<?php

 

session_start();
require_once 'vendor/autoload.php';

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();

$authUrl = "https://auth.calendly.com/oauth/authorize?"
    . "client_id=" . $_ENV_'CALENDLY_CLIENT_ID']
    . "&response_type=code"
    . "&redirect_uri=" . urlencode($_ENVd'CALENDLY_REDIRECT_URI'])
    . "&scope=users:read event_types:read scheduling_links:read events:read";

header('Location: ' . $authUrl);
exit;
?>

Hi there!

Javay here - from Calendly’s Developer Support team. Thanks for reaching out! It looks like you're encountering an error related to the OAuth scope in the API integration. The error message "The requested scope is invalid, unknown, or malformed" typically indicates an issue with the scope parameters being used during the authentication process.

Here’s what might be causing this:

  1. Scope Parameter Formatting: The scope parameter in the URL should be formatted correctly, with the individual permissions separated by spaces. It looks like you're using the correct scope values (users:read, events:read, etc.), but I recommend checking the formatting for any unexpected spaces or characters. It should be a single, properly formatted string.

  2. Scope Permissions: Double-check that the scope you’re using aligns with the permissions your app requires. If you're unsure, you can review the available scopes in the Calendly API documentation to confirm you're using the correct ones.

  3. Client ID and Redirect URI: Ensure that the client_id you're using is correct and matches what's registered in your Calendly app, and that the redirect_uri matches exactly with the URI you’ve registered in the Calendly developer portal. Any mismatch here could also lead to issues with the OAuth flow.

  4. Regenerate OAuth Credentials: If the issue persists, I’d recommend regenerating the OAuth credentials in your Calendly developer portal and testing the flow again.

Once you’ve double-checked these elements, try the authorization flow again. If you still encounter the error, feel free to reach out to us at support@calendly.com with any additional details (like the full request URL or the steps you’re following), and we can help troubleshoot further.

I hope this helps!


Reply