google-ar / arcore-unity-extensions

Google ARCore Extensions and Geospatial Creator for Unity's AR Foundation
Other
352 stars 98 forks source link

Persistent Cloud Anchors - ErrorNotAuthorized #22

Open JosquinDpt opened 4 years ago

JosquinDpt commented 4 years ago

Testing with AR Foundation on Android:

Unity 2019.4.11f1 AR Foundation 4.1.0 Preview 9 ARCore Extensions 1.20

Running the sample scene, everything is going well until the CreateCloudAnchor is triggered: Host Failed Failed to host a Cloud Anchorwith error Error Not Authorized

I'm running it with the keyless setting.

JosquinDpt commented 4 years ago

It looks like KeyLess doesn't work for now, even if it's the recommended option: image image

Using an API fixed the issue.

Rikhta commented 4 years ago

How do you do that?

JosquinDpt commented 4 years ago

Using an API key instead of keyless. But it's definitely not a good solution because the key are not persistent using this method. I'm still trying to figure out how to use keyless but no luck for now.

Rikhta commented 4 years ago

I try too. If I find something, I will post here.

JosquinDpt commented 4 years ago

In Google Cloud Platform:

In Unity, keyless is selected, no API key is set.

When I start the app I don't see any consent screen, is is normal? After placing an Anchor it's still: Error Not Authorized

michelepanegrossi commented 4 years ago

I am also trying to get this to work. I have followed the instructions for Keyless authentication but I keep getting the same Error Not Authorized.

Is this really not available yet or am I doing anything wrong?

JosquinDpt commented 4 years ago

@tedruxpin Any chance to have more details on this issue? The documentation seems to be lacking something, or it's because of all the preview packages and new Unity version we are using that just doesn't work. Is there a project setup somewhere with the right packages, Gradle version (I'm not talking about the sample)? Thanks

elCangrejo commented 3 years ago

I had the same problem with the authorization. After updating the project to 2020.2.0b11 it seems to be working. I can host and resolve a persistent anchor, with keyless method.

I was running 2020.1.10 before, which had the ErrorNotAuthorized issues. The major difference between these editor versions is the updated Gradle version integrated in 2020.2, the older version needed to install the Gradle 5.6.4 (that is required for the Arcore Extensions to work) manually, so maybe the problem lies somewhere there

hcnw commented 3 years ago

I had the same problem with the authorization. After updating the project to 2020.2.0b11 it seems to be working. I can host and resolve a persistent anchor, with keyless method.

I was running 2020.1.10 before, which had the ErrorNotAuthorized issues. The major difference between these editor versions is the updated Gradle version integrated in 2020.2, the older version needed to install the Gradle 5.6.4 (that is required for the Arcore Extensions to work) manually, so maybe the problem lies somewhere there

@elCangrejo Can you please explain more about how you handled gradle version? Any changes you made or it is just Unity version update that did the magic? I tried with new Unity version but still the same authorization issue!

Thanks,

elCangrejo commented 3 years ago

@hcnw So if you are running 2020.1 or below you can download the Gradle version 5.6.4. on this website. You install it and then you can set it as Gradle Path in your Unity Preferences under External Tools.

At the moment I'm using version 2020.2.1 and I didn't have any problems with this specific error. So if the Gradle is not working, maybe consider upgrading to the newest version. If that is also not working, then it is probably time to pray to the Unity gods

cloudnp commented 3 years ago

@elCangrejo What you're talking about is a one-day anchor? Or do you mean Persistent Anchor?

elCangrejo commented 3 years ago

@elCangrejo What you're talking about is a one-day anchor? Or do you mean Persistent Anchor?

I'm talking only about the persistent Anchors with keyless method.

kshitizsv-vizara commented 3 years ago

for me,

@hcnw So if you are running 2020.1 or below you can download the Gradle version 5.6.4. on this website. You install it and then you can set it as Gradle Path in your Unity Preferences under External Tools.

At the moment I'm using version 2020.2.1 and I didn't have any problems with this specific error. So if the Gradle is not working, maybe consider upgrading to the newest version. If that is also not working, then it is probably time to pray to the Unity gods

For me, i am able to host an anchor but it can only be resolved in the device that hosted it. If i try to resolve it in another device, failed to resolve: not authorized error comes. is there any way to resolve it in another device ?

kshitizsv-vizara commented 3 years ago

Got is working Guys. Try using:

ghost commented 3 years ago

How did you update your gradle version in Unity3d?

ghost commented 3 years ago

@kshitizsv-vizara provide a step by step solution. How did you set the gradle version? How did you set the Android Extension version? Your comment is quite vague

ghost commented 3 years ago

The solutions offered here no longer work. I have tried running the Persistent cloud anchor sample app and I still can't host anchors.

devbridie commented 3 years ago

I can't seem to reproduce this problem; here are the steps I followed:

  1. Get the persistent cloud anchor sample app to work by following various instructions on the quickstart and build for Android 11.
  2. Verified that the project does NOT work, as I did not configure any Google Cloud Platform settings.
  3. In a new GCP project, I created a OAuth 2.0 client ID (and configured an OAuth consent screen), using package name from Player Settings > Android > Other Settings > Package Name and SHA values from keytool -keystore ~/.android/debug.keystore -list -v.
  4. Enabled the ARCore Cloud Anchor API in GCP.
  5. Rebuilt and ran the Persistent Cloud Anchor sample app. This time, I was able to host an anchor.

I'm also using gradle-6.8.3, but I don't think that should matter (posting just in case)

Here are some troubleshooting steps; try them out and ensure that the values in your Google Cloud project match:

  1. Check the SHA-1 key used to sign your apk and ensure it's the same as the key in GCP: Android/sdk/build-tools/30.0.1/apksigner verify --print-certs built-unity-game.apk
  2. Use aapt to confirm the package name of your built apk and ensure it's the same as the package name in GCP: Android/sdk/build-tools/30.0.1/aapt dump badging built-unity-game.apk | grep package:
ghost commented 3 years ago

@devbridie I followed your instruction but now I can't even find the option for keyless cloud anchor hosting. Why are the Unity tutorials so fragmented for ArFoundtion? Please provide a step-by-step guide as to what I should do.

devbridie commented 3 years ago

Keyless documentation is located here!

ghost commented 3 years ago

huh? Of course I know about that. I tried that, it doesn't work. I still get the Error Not Authrized message.

ghost commented 3 years ago

Any update on this? Either offer a solution or tell us that is not working so we may stop wasting our time. There is no one to message in Google to make this work as well. You need to fix your customer service for cloud anchors

ChristianSchnellmann commented 3 years ago

We can't get keyless authentication to work either. Any update on this would be appreciated.

hcnw commented 3 years ago

After trying multiple times, realized this is intentional

On Mon, Jun 21, 2021 at 11:39 PM ChristianSchnellmann < @.***> wrote:

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

We can't get keyless authentication to work either. Any update on this would be appreciated.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google-ar/arcore-unity-extensions/issues/22#issuecomment-865240059, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYZMAWCSUQMBURNHPDL5YDTT5535ANCNFSM4SHYYFAA .

ghost commented 3 years ago

@hcnw how do you know this is intentional?

hcnw commented 3 years ago

I do not know exact but I think it should have worked for someone by now if it was functional. Also, there is no resolution to this so far

On Tue, Jun 22, 2021 at 2:45 PM iAmJuan550 @.***> wrote:

This message was sent from a non-IU address. Please exercise caution when clicking links or opening attachments from external sources.

@hcnw https://github.com/hcnw how do you know this is intentional?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/google-ar/arcore-unity-extensions/issues/22#issuecomment-865794644, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALYZMAWZIWD3ZWTHD6CPTR3TUBIELANCNFSM4SHYYFAA .

elCangrejo commented 3 years ago

Since I ran into trouble with my team again, regarding the persistent Anchor creation, I can share some tips:

Saicopate commented 3 years ago

For those fighting with ErrorNotAuthorized problem - check your if your androidresolverdependencies.xml file contains the following references:

Assets/Plugins/Android/android.arch.core.common-1.0.0.jar Assets/Plugins/Android/android.arch.lifecycle.common-1.0.0.jar Assets/Plugins/Android/android.arch.lifecycle.runtime-1.0.0.aar Assets/Plugins/Android/com.android.support.support-annotations-26.1.0.jar Assets/Plugins/Android/com.android.support.support-compat-26.1.0.aar Assets/Plugins/Android/com.android.support.support-core-ui-26.1.0.aar Assets/Plugins/Android/com.android.support.support-core-utils-26.1.0.aar Assets/Plugins/Android/com.android.support.support-fragment-26.1.0.aar Assets/Plugins/Android/com.android.support.support-media-compat-26.1.0.aar Assets/Plugins/Android/com.android.support.support-v4-26.1.0.aar Assets/Plugins/Android/com.google.android.gms.play-services-auth-base-16.0.0.aar Assets/Plugins/Android/com.google.android.gms.play-services-base-16.0.1.aar Assets/Plugins/Android/com.google.android.gms.play-services-basement-16.0.1.aar Assets/Plugins/Android/com.google.android.gms.play-services-tasks-16.0.1.aar

It took me a lot o time to point down the cause of this error.

Renkon117 commented 3 years ago

Anyone having trouble building on iOS platform? How do I build iOS app with Authentication Token?

スクリーンショット 2021-07-13 19 33 06
devbridie commented 3 years ago

@Renkon117, please see instructions on the Cloud Anchors developer guide for iOS for how to use SetAuthToken at runtime.

As mentioned on the other thread, we've identified a problem with Unity's package cache isolation and are working towards a fix. In the meantime, here are some troubleshooting steps from that thread:

  1. Check for the existence of ProjectSettings/AndroidResolverDependencies.xml. If this does not exist, then probably this is the source of problems;
  2. Check Temp/gradleOut/unityLibrary/build.gradle; this should contain some lines with 'com.google.android.gms.

If this is the case, then GMS authentication libraries are missing at runtime, and this causes authentication to fail.

This may be caused by incorrect permissions in our provided tgz. If you're encountering this, a possible workaround is to remove ARCore Extensions from the Package Manager, then extracting the tgz first, then use Import from Disk to import the resulting package.json. Trigger a new build, and (1) and (2) should appear from above.

sam1am commented 3 years ago

I have run into this error many times and for many reasons. The latest was solved by deleting ProjectSettings/AndroidResolverDependencies.xml and letting Unity regenerate it. Others have pointed to this solution above, but I wasn't clear on how exactly to add the references needed. Deleting it was the answer.

ghost commented 3 years ago

I solved the problem by importing the ARCore extensions from the package manager

rc1 commented 2 years ago

Worth noting you need to enable the API in the console: https://console.cloud.google.com/apis/library/arcore

TimmyBest commented 1 year ago

ttl = 365 strikes back

ARCore Extensions Version 1.37.0 Unity 2021.3.16 ErrorNotAuthorized -- after updating to the new API.

Old API worked perfectly. Token is verified and valid,

API key -> works great

Nothing from above worked for us.

This is the 3rd time this project breaks due to ARCloudAnchor API update.

@devbridie Please help us! Again 😔

hlefe commented 9 months ago

ttl = 365 strikes back

ARCore Extensions Version 1.37.0 Unity 2021.3.16 ErrorNotAuthorized -- after updating to the new API.

Old API worked perfectly. Token is verified and valid,

API key -> works great

Nothing from above worked for us.

This is the 3rd time this project breaks due to ARCloudAnchor API update.

@devbridie Please help us! Again 😔

Hello everyone,

I'm not developing with Unity but rather with Flutter, and I too encountered the ErrorNotAuthorized issue while working with cloud anchors (using the plugin ar_flutter_plugin_flutterflow). The discussions in this thread have been immensely helpful in guiding me towards a resolution. I'd like to contribute back by sharing a couple of things that resolved my issue, which might help others in the future:

Upgrade AR Core to version 1.33 in build.gradle: implementation "com.google.ar:core:1.33.0"

Because it seems that cloud anchors no longer work with previous versions, leading to the ErrorNotAuthorized error. This upgrade was a crucial step in resolving the issue. It's also essential to ensure that the ARCore API is enabled, as the ARCore Cloud Anchor API relies on it. More information can be found here: ARCore Cloud Anchors Endpoint Changes.

Disabling Minification in Release Mode: After making the above changes, the ErrorNotAuthorized disappeared in the debug mode, but it reappeared upon switching to release mode. To address this, I disabled code shrinking and minification by adding the following lines to my app/build.gradle:

buildTypes {
    release {
        minifyEnabled false
        shrinkResources false
    }
}

This step ensured that the release version of my app worked without triggering the ErrorNotAuthorized error. I hope this helps anyone facing the same issue. It's always a bit tricky navigating these errors, but with a community sharing insights and solutions, it becomes much more manageable.

LexDeKogel commented 2 months ago

I never had this issue before but after updating the In App Purchasing package (which is required by google) I get this every time on Android.

I am lost, I tried updating AR core, I tried updating Unity, I tried disabling minification. Nothing seems to work and I don't understand why. Nothing else seems to be effected by updating that package, just this. Anyone have any ideas on what I can try next? I'm on Unity 2021.3.43f1

Edit: Of course I find it right after commenting. The package update forced me to get rid of my old resolved android libraries, otherwise it fails to build. Turns out I had to keep these:

Keeping any of the other jar files from the large list causes build errors, not keeping these causes AR anchors to be unauthorized 😵