arcore-unity-extensions icon indicating copy to clipboard operation
arcore-unity-extensions copied to clipboard

Persistent Cloud Anchors - ErrorNotAuthorized

Open JosquinDpt opened this issue 4 years ago • 36 comments

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 avatar Oct 07 '20 18:10 JosquinDpt

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

Using an API fixed the issue.

JosquinDpt avatar Oct 08 '20 17:10 JosquinDpt

How do you do that?

Rikhta avatar Oct 13 '20 13:10 Rikhta

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.

JosquinDpt avatar Oct 13 '20 14:10 JosquinDpt

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

Rikhta avatar Oct 13 '20 14:10 Rikhta

In Google Cloud Platform:

  • OAuth 2.0 Client IDs is setup with the package name and a certificate fingerprint
  • A consent screen is setup with image

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

JosquinDpt avatar Oct 14 '20 13:10 JosquinDpt

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?

michelepanegrossi avatar Oct 14 '20 17:10 michelepanegrossi

@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

JosquinDpt avatar Oct 21 '20 15:10 JosquinDpt

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 avatar Nov 13 '20 14:11 elCangrejo

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,

hcnw avatar Feb 12 '21 07:02 hcnw

@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

elCangrejo avatar Feb 12 '21 17:02 elCangrejo

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

cloudnp avatar Feb 16 '21 06:02 cloudnp

@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.

elCangrejo avatar Feb 17 '21 13:02 elCangrejo

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 avatar Mar 02 '21 10:03 kshitizsv-vizara

Got is working Guys. Try using:

  • unity version 2020.2.6f1
  • Gradle Version 6.8.3
  • Android Extension version 1.23

kshitizsv-vizara avatar Mar 03 '21 12:03 kshitizsv-vizara

How did you update your gradle version in Unity3d?

ghost avatar May 25 '21 22:05 ghost

@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 avatar May 25 '21 23:05 ghost

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

ghost avatar May 25 '21 23:05 ghost

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:

devbridie avatar May 26 '21 13:05 devbridie

@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.

ghost avatar May 26 '21 15:05 ghost

Keyless documentation is located here!

devbridie avatar May 26 '21 15:05 devbridie

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

ghost avatar May 26 '21 15:05 ghost

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

ghost avatar Jun 15 '21 17:06 ghost

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

ChristianSchnellmann avatar Jun 21 '21 18:06 ChristianSchnellmann

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 .

hcnw avatar Jun 22 '21 04:06 hcnw

@hcnw how do you know this is intentional?

ghost avatar Jun 22 '21 09:06 ghost

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 .

hcnw avatar Jun 22 '21 09:06 hcnw

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

  • Run the newest Unity Version possible (2020.3.1 is working fine for me)
  • Try Assets> External Dependency Manager > Android Resolver > Force Resolve
  • Be patient!!! For my Team it took a day, after adding the keystore SHA to the Google Developer Console, until the Hosting & Resolving was working without troubles

elCangrejo avatar Jul 01 '21 10:07 elCangrejo

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.

Saicopate avatar Jul 04 '21 12:07 Saicopate

Anyone having trouble building on iOS platform? How do I build iOS app with Authentication Token? スクリーンショット 2021-07-13 19 33 06

Renkon117 avatar Jul 13 '21 10:07 Renkon117

@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.

devbridie avatar Jul 14 '21 18:07 devbridie