x

You must be logged in as the user you're trying to install to

Hello.
I am trying to create an app using the API.

The first step, was to complete the authorization flow.
The problem I have, is next.After I click to connect the app to my site, I get the hmac.
After I create my authorization url with the parameters that I got from the above, with the base url being the callback_url.
But when I try to use GET, to obtain the authorizationCode, it tell's me that "You must be logged in as the user you're trying to install to".
I read on your Troubleshooting page, that it can occur because of two thing.
The first, is that I hardcoded an url endpoint in the callback url.I haven't, I use the one that Weebly sent me.
And the second one, that I did not include the client_id in the url. I did that too.
What might cause me this problem.

2,584 Views
Message 1 of 5
Report
1 Best Answer

Best Answer

1. Yes, you can install the app to your test site from the Developer Admin which will let you test things out properly from an app consumer's perspective, as well as to debug. You will need to either push the app to an SSL-enabled web server or use a tool such as `ngrok` to have a secure local tunnel to run the app from.

2. The answer to your first question, should resolve your second question. Smiley Happy

Let me know if this helps.

View Best Answer >

2,506 Views
Message 4 of 5
Report
4 REPLIES 4

Hello @Bala

Yes it looks like you are having issues with the OAuth.  I did notice in your manifest that the callback_url is pointing to a localhost: file, which is causing these errors during the redirect:
 
 
 
Make sure you have thoroughly read the documentation for App Installation Flow and Authencation. You had stated, "After I create my authorization url with the parameters that I got from the above, with the base url being the callback_url.". Are you properly redirecting back to Weebly for an Authorization Code and then exchanging the Authorization Code for a valid Access Token?
 
You might be able to use the Weebly Client for PHP, or the Weebly Node Webhook Client to test things or see code examples of this working as expected.
 
Does this help resolve your question?
Tags (3)
2,537 Views
Message 2 of 5
Report

I have few questions about the app.

  1. It is possible to use the app thru the API if it’s not approved / published?
  2. My problem is that I have the callback handling logic running locally. And because I can’t finalize the app, I can’t check-in -> change the callback url to another one (other than localhost). It’s a vicious circle.
    One solution is to give another callback-url that would have an empty logic on callback but will pass your tests. Once you approve the app, I will continue to work on the app and whenever new changes are made, you can re-validate the app.
    Is this something that we could do?
2,517 Views
Message 3 of 5
Report

Best Answer

1. Yes, you can install the app to your test site from the Developer Admin which will let you test things out properly from an app consumer's perspective, as well as to debug. You will need to either push the app to an SSL-enabled web server or use a tool such as `ngrok` to have a secure local tunnel to run the app from.

2. The answer to your first question, should resolve your second question. Smiley Happy

Let me know if this helps.

2,507 Views
Message 4 of 5
Report

I'm also getting the same error ""You must be logged in as the user you're trying to install to".". Please note that I'm not hardcoding the callback_url and also I have added client_id inside the redirect URL. Moreover, I'm using live domain URL with SSL instead of the localhost URL.

Any help?

1,478 Views
Message 5 of 5
Report