Closed sweetkey closed 2 months ago
Hello, @sweetkey! I'm here to help you with any bugs, questions, or contributions you might have. Let's work together to resolve the issue you're experiencing.
To resolve the "invalid_request" error related to query.client_id
when trying to add a workspace from Notion in Dify version 0.7.0, ensure that the client_id
is correctly set and passed in the authorization URL. The client_id
is a crucial parameter for OAuth authentication and must be correctly configured.
Here is the relevant part of the code that constructs the authorization URL:
def get_authorization_url(self):
params = {
"client_id": self.client_id,
"response_type": "code",
"redirect_uri": self.redirect_uri,
"owner": "user",
}
return f"{self._AUTH_URL}?{urllib.parse.urlencode(params)}"
Make sure that self.client_id
is correctly initialized when creating an instance of NotionOAuth
. If self.client_id
is not set or is incorrect, it will result in an "invalid_request" error.
Example of initializing NotionOAuth
:
notion_oauth = NotionOAuth(client_id="your_client_id", client_secret="your_client_secret", redirect_uri="your_redirect_uri")
authorization_url = notion_oauth.get_authorization_url()
Ensure that your_client_id
, your_client_secret
, and your_redirect_uri
are correctly provided.
Additionally, if you are using the internal or public integration methods for Notion, make sure to configure the environment variables correctly in the .env
file as follows:
For internal integration:
NOTION_INTEGRATION_TYPE=internal
NOTION_INTERNAL_SECRET=your_internal_secret
For public integration:
NOTION_INTEGRATION_TYPE=public
NOTION_CLIENT_SECRET=your_client_secret
NOTION_CLIENT_ID=your_client_id
These configurations are necessary to ensure that the integration with Notion works seamlessly and the client_id
is correctly recognized.
For more detailed steps on setting up the integration, you can refer to the Dify documentation on importing data from Notion and configuring the integration:
.env
file based on whether you are using internal or public integration.For internal integration:
.env
file as NOTION_INTERNAL_SECRET
.For public integration:
.env
file as NOTION_CLIENT_ID
and NOTION_CLIENT_SECRET
.Following these steps should help resolve the "invalid_request" error related to query.client_id
[1][2][3][4].
To continue talking to Dosu, mention @dosu.
Thanks, I went to Notion Integration Page to enable Integration with an app, and copied & pasted the secret code back to Notion section in ".env", now it solves the error message issue.
sorry to bump that but a warning message instead of an error would be awesome
Self Checks
Dify version
0.7.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
click this "Add workspace" to create a dataset by importing data from Notion, but an error message shows up.
✔️ Expected Behavior
https://docs.dify.ai/learn-more/use-cases/build-an-notion-ai-assistant
❌ Actual Behavior
{"error":"invalid_request","error_description":"query failed validation: query.client_id should be a string or
undefined
, instead was0
.","request_id":"2cae3411-0e34-49d2-9474-17c0218eec06"}