question

Dan avatar image
Dan asked Suraj Dubey commented

SDK ForbiddenException: status code: 403 App doesn't have required permission. (since Clover update)

Our debug apps have been working in the emulator fine for months. Today the emulator received Clover updates for almost all of it's apps. The Clover version reads as 2.0-1872.

Since that update, none of my own debug apps can access the Clover SDK and I receive a permissions violation (specifically MERCHANT_R when I call MerchantConnector#getMerchant()).

Things I have tried:
  • Reinstalling via the App Market (via the web interface - the option to install is not present in the App Market app on the emulator).
  • Restarting the emulator
  • Double checking the permissions are of course still checked on the dashboard
  • Uploading a new release APK to the dashboard (on an unpublished APK), and then redownloading via the App Market web page.
Each time the app works fine when it comes down from the market, but any unsigned apk I now put on my emulator is bricked. Has something changed recently that might cause this to happen?
My emulator is signed in as a production US account which our dev account is tied to (Merchant ID is K8M9CMNXDX1H2)

Finally it seems a shame we can't add our own tags for questions any more, I'm not sure what topics might be available so can't really find anything suitable for this one.

Edit:
Just to confirm this is not an issue on Clover version 2.0-1864. I have another emulator on that and the apps are fine (I will not update it). 1872 has revoked the permissions of all of our other debug apps.

Edit 2:
I have narrowed down the behavior significantly and it's now completely reproducible which is good. The issue arises on a fresh emulator with Clover 1872 when a debug app is uninstalled and then reinstalled. Upon initial installation the app is able to access the SDK without issue. If at any point the app is uninstalled, the app becomes invalidated and can no longer access the SDK. The only solution I can see to this is to reinstall the SDK, and to never uninstall any development apps.

Merchant
9 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

nirmal avatar image nirmal commented ·

Same thing is happening to me since clover apps update. Unable to resolve, any idea?

1 Like 1 ·
lilly avatar image lilly commented ·

Hi @Dan - Thank you for the detail! To clarify, when you uninstall the app, are you going to the App Market and pressing "Uninstall", navigating to the app in "Settings" and doing "clear data", using ADB?

0 Likes 0 ·
Dan avatar image Dan lilly commented ·

Hi Lilly thanks, it's actually neither: on the emulator (outside of Clover) I drag the icon to Android's trash can which prompts me to uninstall. I find that's often the quickest method to reinstall an app if I don't have the adb command loaded up in the terminal, so do it quite often. The fact that the apps work fine before I uninstall like that meant it took me a while to pin down!

0 Likes 0 ·
lilly avatar image lilly Dan commented ·

Great - thank you! We'll be recording this behavior and checking to see if other developers are experiencing this as well.

0 Likes 0 ·
Bryanne Vega avatar image Bryanne Vega commented ·

Might be an obvious thing but, have you've tried rebooting it? Also, yesterday & it seems today they're under maintenance as well, the sandbox environment was facing some issues. Try un-clicking the merchant checkbox on the required modules, save & check it back on & save. Clear data & uninstall your app, reboot & install app.

0 Likes 0 ·
Dan avatar image Dan Bryanne Vega commented ·

Thanks Bryanne yes definitely tried rebooting :) It's in a permanent state of being invalid. I've tried toggling the merchant settings module and toggling the app permissions on and off (each time installing from the market and then reinstalling via adb) to no success.

0 Likes 0 ·
Gabriel Fernandez avatar image Gabriel Fernandez commented ·

@Lili, @Clover_Community_Helper we have the same issue that @Dan. We have two apps on SandBox environment. The first app (2MFKXZ3TR1W2P) work fine regardless of the case. But second one app (V8VC602JBVTFJ) gives 403 App doesn't have required permission: package does not have permission MERCHANT_R and package does not have permission ORDER_R error when it is not downloaded from the market. We have trying everything and nothing solves the problem. This error makes the development process very difficult. Why does first one app work fine and second one not?

0 Likes 0 ·
lilly avatar image lilly Gabriel Fernandez commented ·

Hi @Gabriel Fernandez - Try uninstalling from the App Market (go into App Market, search for your app, uninstall using the Uninstall button), clearing your device cache in Settings, reinstalling from App Market, testing to make sure you have the permissions, and then sideloading the app.

I believe any other type of uninstalling that usually isn't supported by Clover ('clear data' in Settings or just dragging it to the trash can) may be part of the problem. If this doesn't work, please let me know.

0 Likes 0 ·
Suraj Dubey avatar image Suraj Dubey commented ·

@Lee Tickett I was getting merchant id properly before publishing app in clover marketplace.Its still in verification phase .Now today when am checking for merchant id it showing this error.Please help

0 Likes 0 ·
Gabriel Fernandez avatar image
Gabriel Fernandez answered Miguel Deactivated edited
[Moderator Note] I edited the steps below to represent the best steps to take to fix this issue. Please see this article for the full explanation of the issue and workaround: How to sideload an APK onto Clover devices for development

Finally i have found the solution or better said i have found the way to handle this weird issue. If you have any issue with Application Permissions under development phase and you are aware that you has set permissions correctly on app Dashboard, you have to do the following.

  1. Make sure your app is installed from the Clover App Market.
  2. Uninstall your app from the device using adb uninstall command.
  3. Install your app development APK directly on the Clover device or emulator using the adb install command. Not from the App Market.
Seems to be when first you install app directly on device (not from app market) and then you press Install from developer dashboard, it transfers permissions to devices. It is the only way i have found to handle this weird issue.

I hope Clover Developer Team fix the issue in order to make easy development process.We need install our development app from all available ways and as we are on sandbox environment, we need to have the guarantee that clover will give all configured permissions to our app.
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

lilly avatar image lilly commented ·

Thanks for your details @Gabriel Fernandez!

0 Likes 0 ·
Dan avatar image Dan commented ·

Yes it looks like this ridiculous set of steps seems to work thanks Gabriel :D I had to sync the app market on the device after hitting install to be sure. Well done for figuring out a way through!

0 Likes 0 ·
Gabriel Fernandez avatar image
Gabriel Fernandez answered thedangler commented
Hi @Lilly i did everything you told and it does not work. We are programming using Sandbox Clover Flex device not emulator. We tested app on Sandbox Clover Station and Clover Mini it worked well.Could the clover-sdk latest-release(168) be the root of the problem?

I can't stay production version installed on device because production and development versions has not the same signature. If we do that, the deploy process give an error like this [INSTALL_FAILED_UPDATE_INCOMPATIBLE].

I will test downgrading clover-sdk version to tell you if clover recognize app permissions.
1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

thedangler avatar image thedangler commented ·

@Gabriel Fernandez

I'm getting the INSTALL_FAILED_UPDATE_INCOMPATIBLE error once I download my "release" app from sandbox store and try to sideload an updated version.

How did you fix this?

I'm using flex devkit.

I'm going insane because their instructions don't work.

0 Likes 0 ·
Bejoy Nair avatar image
Bejoy Nair answered
Thanks Gabriel. Your steps worked for me.
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

varghesekutty avatar image
varghesekutty answered varghesekutty published
Its not in the App Market. Then how can we fix it?
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Lee Tickett avatar image
Lee Tickett answered Dan edited
Always stumbling on this same issue. Permissions are fine when installing through the app market, but when trying to sideload we get are forced to uninstall first which loses the permissions. Any suggestions?
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dan avatar image Dan commented ·

I cannot explain in words how frustrating it is. Literally every single day I have to go through the same rigmarole I have it burned into my brain now. Install app, watch it fail to access a permission, go to web app market, toggle uninstall, sync app market on device, re-open app. We have multiple apps, multiple sandbox devices and multiple people on multiple emulators so there is no way around it for me. Anything on a sandbox should be whitelisted like it used to be. What Jeff says in his answer there is not entirely true:

You only need to do this once. The Clover device will not update your single-signed APK. In fact, it cannot, for the same reason you could not update the previously installed double-signed APK.

For example, reboots cause the app market to override whatever has been sideloaded onto the device.

1 Like 1 ·
Dan avatar image Dan ♦ Dan commented ·

if your version code is higher than the version code for the apk published in app market (internally we use 32000 for sideloads), then app market should not replace the apk that you sideloaded.

0 Likes 0 ·
sam avatar image
sam Deactivated answered thedangler commented
@Lee Tickett @Dan
If you're seeing this error "INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES", or having issues with maintaining permissions when sideloading, please take a look at this quick video on steps to properly sideload on Clover Devkits:
https://youtu.be/Sk0aZzlocog
6 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

thedangler avatar image thedangler commented ·

This did not work for me. I'm getting the INSTALL_FAILED_UPDATE_INCOMPATIBLE error so I tried following your video. Unfortunately there is no reload button in the app in the app market and cannot complete the video.

How am I supposed to make a release to the sansbox market to and install my app on my device and then be able to keep developing with it without having to make a new release every F***(* time. This is driving me insane.

1 Like 1 ·
Dan avatar image Dan thedangler commented ·

Yes the removal of the manual sync button certainly makes this issue worse :D There is a knack to it, swiping the app market away via the recents button clears it from memory so I think doing that and relaunching is the best way to 'simulate' a sync so that your app will have valid permissions.

The incompatible error dialog is because the app market app is installing first. If you get that you have to reinstall from the market. You have to install your app after hitting install on the market, after the permissions have synced, but before the app market manages to download to the device, so it's about timing.

Once again if anyone from Clover has another look at this it has got to be your biggest developer issue. If we are on Sandbox only I would like to urge you to reconsider why app permissions aren't wide open like they used to be, it would really save a lot of headaches.

0 Likes 0 ·
thedangler avatar image thedangler Dan commented ·

I finally got it working. I installed my app via the sandbox store. Uninstalled it with adb. installed it from android studion and in the transactions app hit the sync button. For some reason that made it work.
In some instructions I found it said to use the register sync button, but not all devs have register app.

I agree, in the sandbox permissions should be open. no need to upload and download an app.

Also, wonder why merchant info isn't access directly from the device.

thanks for the help

1 Like 1 ·
Dan avatar image Dan commented ·

Thanks Sam that's basically what I do, great video. I've learned to live with it now! I install via the Web app market because sometimes the app market apk crashes on me or fails to install, so just toggling uninstall on the web and syncing on the device I find to be faster. The problem arises when you need to uninstall an app and leave it off the device for a certain period of time - if you do it via adb the app market will eventually reinstall it in which case you are back to square one. And reboots also cause the market to reinstall. I realise it's not a problem for people that are only working on one app or with one dev so that's why I don't mind too much :)

0 Likes 0 ·
sam avatar image sam Dan commented ·

Hey Dan,
Thanks for working around it, we hope you understand it's due to how Clover maintains security of our devices.

I tried rebooting 5-times, and only the first time rebooting did the permissions get removed from the sideloaded app. The other four times maintained permissions and worked as expected. I wasn't able to quite catch the cause but my intuition is that only when an underlying app (ie. Engine or App Market) gets updated does the permissions become invalid. I'll keep looking into why your reboots are removing your app permissions and let you know if I find anything.

1 Like 1 ·
Dan avatar image Dan sam commented ·

Thanks Sam yeah if we could take the fact that the app market literally installs on top of sideloaded apks out of the equation it might help (not just permissions invalidation). The other issue is our sideloads become unwhitelisted for USB devices under what I suspect is the same conditions. So even if reboots, the Engine or the App Market didn't invalidate our app permissions we're still needing to reinstall sideloaded builds for problems like that.

0 Likes 0 ·
Lee Tickett avatar image
Lee Tickett answered thedangler commented
I have found the sync button in the orders app or register app achieves the same desired affect of reloading the app market permission after you sideload the app.
So technique now is;
- upload apk to sandbox and click preview in app market
- click install (still from web dashboard)- app should install on all sandbox devices (if you have previously sideloaded you will need to uninstall it first or it will fail to install)
- now sideload through android studio (and say yes to reinstall when prompted about the invalid or non matching certificate
- at this point your app wont have any permissions
- open the orders app and press sync
- you should now be good to go
Let me know if that works for you!
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Dan avatar image Dan commented ·

Ah yeah I forgot about those sync buttons, one day they could be gone too though :)

0 Likes 0 ·
thedangler avatar image thedangler commented ·

It works, I used the transaction app to do the same thing.

0 Likes 0 ·

Welcome to the
Clover Developer Community