3.1.0 & 3.1.1 - Canva Connection Error

Hi Guys,
I’m trying to connect Canva to my CMS 3.1.0 Version, and it throws an error:

{
success: false,
error: 404,
message: "404 Not Found",
help: "The requested resource could not be found. Please verify the URI and try again."
}

CMS: 3.1.0 - Manual Installation - IIS Server

It’s everthing like the tutorial… and i already tryed to reset the registration right there:
https://canva.xibosignage.com/register

Theres any configuration that i have to do in the CMS instalation or missing?
Many Thanks!!

Hi, it could be a number of things as unsure of your setup, but you could start by making sure that web is not in the URL of your CMS.

You will also need to do this, adapting for Windows and the path to your CMS Library:

Hi Natasha!

I did tested my API connection generating a access token using Postman after follow the tutorial steps that you send to me:

And it work’s… but the Canva connection still throwing the same error…

but you could start by making sure that web is not in the URL of your CMS.

So sorry, I think I didn’t understand what you meant

Thanks again! :slight_smile:

As the above link suggests, take a look at the Prepare your Environment page from the manual installation doc.

I hope that is some help? :slight_smile:

Hi Natasha! thanks for answering

Updating: Now i’m using the CMS 3.1.1

So… I set up the CMS as described in the tutorials you sent me.
I even generated an “Access Token” via Postman without errors.

But the connection to Canva doesn’t work as it should.

  • In my URL there is nothing related to the “Web” folder

  • The “certs” folder (in my libraly folder) is correctly configured with the 3 files “encryption.key”, “private.key”, “public.key” generated according to the topic: Canva on xibo 3.0.3 - #2 by natasha

  • I tested the connection with canva with 02 different CMS’s on two different servers, both did not work.

  • This is the URL generated by canva (I’m hiding the sensitive information(CMS address and ClientID), but I can send it to you in private.)

https://MYCMSADDRESS/api/authorize?state=bb23832d6719066ead2489af39b56f95&scope=&response_type=code&approval_prompt=auto&redirect_uri=https%3A%2F%2Fcanva.xibosignage.com%2Fcomplete&client_id=MYCLIENTID

  • this is the error displayed:

image

Anything else I might have forgotten to check, or something missing from that URL that should (or shouldn’t) be there?

Thank you! :wink:

I noticed that the “scope” variable in the URL is empty… that is correct?

(in my application scopes is checked with “Full account access”)

Hi, I have discussed this with the team who have said the following:

Requests for /api/authorize should be routed to api/authorize/index.php whereas everything else under /api gets routed to api/index.php

At a guess you may have converted the .htaccess file into whatever IIS uses and that rule is either missing or not being correctly applied to the request. Take a look at this section IIS to convert, however we don’t support IIS directly and we don’t have access to test I am afraid.

If this is not the case then please do come back to us!

1 Like

Hello Natasha! you helped a lot, thank you
I finally found out what was going on there.
I’m using IIS, and actually the .htacces conversion was being done correctly.
But the problem was in the URL generated by the CMS.

take a look, this is the URL generated by the CMS:

https://MYCMSADDRESS/api/authorize?state=.........

But both HTACCES and web.config expected the slash “/” after the “authorize” word in the regex pattern like this:

https://MYCMSADDRESS/api/authorize/?state=.........

So I changed the pattern rule to redirect to “api/authorize/index.php” file without the need for slash after “authorize”
Like this:

<add input="{URL}" pattern="^/api/authorize.*$" ignoreCase="false" />

This is how the connection with canva worked to me. :slight_smile:

I have the same error in version 3.1.4 that I displayed this message:

{“error”:0,“message”:“API configuration problem, consult your administrator”}

And in the registry Register | Xibo Canva Connector it shows that everything is ok: Registered, please connect again through Canva.

I also created the certs folder and the three files “encryption.key”, “private.key”, “public.key”

This is the URL generated by canva:
https://MYSITE/cms/web/api/authorize/?state=7414faea4b77507c5596c64b7945c171&scope=&response_type=code&approval_prompt=auto&redirect_uri=https%3A%2F%2Fcanva.xibosignage.com%2Fcomplete&client_id=MYID

I found it in debug, can you help me?

1202,bf333f2,“2022-08-31 01:21:46”,AUTH,/api/authorize/,GET,“Key path "file://library/certs/private.key" does not exist or is not readable”,ERROR
1203,bf333f2,“2022-08-31 01:21:46”,AUTH,/api/authorize/,GET,“API configuration problem, consult your administrator”,ERROR
1204,bf333f2,“2022-08-31 01:21:46”,AUTH,/api/authorize/,GET,"#0 [internal function]: Xibo\Middleware\ApiAuthentication->Xibo\Middleware{closure}(Object(DI\Container))

Try doing the full reset first as you have now added encryption keys etc. Failing that you could look at your CMS installation as you have web in the URL so correcting that may solve your issue: Prepare your Environment

Oi Raimundo, você é brasileiro certo?
Vou escrever em português pq vai ficar mais fácil de entender…

O seu problema cara está na URL gerada pela integração do Canva pelo que me parece… a solução foi descrita na minha resolução, leia com atenção:

Aí está dizendo que um padrão possui uma barra “/” e no outro não possui essa barra depois da palavra “autorize”.
Isso faz com que o regex de redirecionamento não funcione.

Você usa oq pra controlar as regras de redirecionamento de URLs? Web.config do IIS ou o HTACCESS?

Se usar o IIS/ Web.config, copie as regras que está no print da solução do tópico.
Se esse for o problema, irá resolver.
Me avise aqui se não der certo!

===================

English (free translation):

Hi Raimundo

It looks like that your problem is in the URL generated by the Canva integration as it seems to me… the solution was described in my resolution, read carefully:

There it is saying that one pattern has a slash “/” and the other does not have this slash after the word “authorize”.
This causes the redirect regex to not work.

What do you use to control URL redirection rules? IIS web.config or HTACCESS?

If using IIS/Web.config, copy the rules that are in the print of the topic’s solution.
If that’s the problem, it will fix it.
Let me know if it doesn’t work out!

Além de tudo, siga todos os passos que a Natasha te enviou em relação as encryption keys.
esses 03 arquivos tem que estar na sua biblioteca:

Segue o tutorial de como gera-los facilmente:

======================
English (free translation):
In addition, follow all the steps that Natasha sent you regarding encryption keys.
these 03 files must be in your library:

Here’s the tutorial on how to easily generate them:

1 Like

One doubt the private key has to be 1024 or 2048?

image

A summary of what I did:

1 - I created the Application with the name Canva and marked what I asked for.

2 - I created the folder pointing to the /web folder and put the SSL certificate.

3 - I created the 3 .key files following what our colleague said:
RSA (Private and Public): Online RSA Key Generator
Encryption: https://generate.plus/en/base64

4 - I placed the files inside the xibo/Library/certs folder

5 - In my .htaccess I left it like this:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/api/authorize/.*$
RewriteRule ^ api/authorize/index.php [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/api/.*$
RewriteRule ^ api/index.php [QSA,L]

6 - And in ConfigService it was like this:

$this->apiKeyPaths = [
‘publicKeyPath’ => $libraryLocation . ‘certs/public.key’,
‘privateKeyPath’ => $libraryLocation . ‘certs/private.key’,
‘encryptionKey’ => file_get_contents($libraryLocation . ‘certs/encryption.key’)
];

7 - When I tried to validate in CANVA with my link: https://app.faciltv.com.br

8 - Show me the message:

{“error”:0,“message”:“API configuration problem, consult your administrator”}

9 - And the link that shows this:

https://app.faciltv.com.br/api/authorize/?state=298ceeXXXXXXXXb3feXXXXXXXXXXb87c4&scope=&response_type=code&approval_prompt=auto&redirect_uri=https%3A%2F%2Fcanva.xibosignage.com%2Fcomplete&client_id=XXXXXX287dXXXXXXF403c28aeXXXXXXXXXX8a

private key has to be 2048
and Encryption key has to be 32 bytes

Are you using docker or a custom install in you CMS?

CMS in PHP, would docker be the best option?

From where he gets the private.key because the path file://library/certs/private.key I don’t know where it is.

1337,4e61830,“2022-08-31 20:28:13”,AUTH,/api/authorize/,GET,“Key path "file://library/certs/private.key" does not exist or is not readable”,ERROR
1338,4e61830,“2022-08-31 20:28:13”,AUTH,/api/authorize/,GET,“API configuration problem, consult your administrator”,ERROR

Check your database to see if you library path is correct:

SELECT * FROM setting where setting = ‘LIBRARY_LOCATION’;

image

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.