What occurred thus far?
I’ve an iOS utility working, which makes use of the ARfoundation to point out digital objects within the realworld and the ARCore API to host and resolve cloud anchors https://builders.google.com/ar/develop/cloud-anchors
To date, I’ve managed to get the internet hosting course of achieved with using an API-Key.
Nevertheless, through the use of an API-Key the Cloud Anchors can solely be hosted for 1 day.
To increase the cloud anchors time-to-live (as much as three hundred and sixty five days) a Keyless authentication should be used (Oauth2).
Unfortunatly I’ve no expertise with Cryptograhy, Authentication-Processes or related however are at all times open to be taught one thing new.
Setup
Initially, I’ve created a service-account inside google dev console and downloaded the credentials in json format.
Administration API
Googles documentation recommends to make use of their OAuth2l to handle the cloud anchors.
I’m able to learn all cloud anchors, every time I host them with the API-Key. Since they’ve expired since I’m making an attempt to get keyless-auth. working, studying the Administration API simply returns an empty checklist (which is okay imo).
Getting ID-Token
With the assistance of Postman I can get an id-token efficiently, by passing a JWT token (hand-generated in jwt.io):
Postman Request config
JWT Creation
Profitable response of API:
Postman Response
Authenticating in Unity
Google’s ARCore Extensions for Unity’s ARFoundation add a perform referred to as SetAuthToken(string token) to the ArCloudAnchorManager which ought to be executed with ah legitimate access-token earlier than internet hosting the cloud anchor with the perform HostCloudAnchorAsync(…).
In a primary step I attempt to hard-code the id-token to the source-code to see if the authentication works in any respect (my token are legitimate for 60min, inside this time im in a position to construct and take a look at the app :)).
I’ve tried passing the id-token to the SetAuthToken() perform, with none error however when internet hosting the cloud anchor I obtain “ErrorNotAuthorized”.
With all of the totally different token varieties (bearer-, id-, access-token) I’m very confused and dont know learn how to authenticate correctly.
Might please anyone assist me understanding what I’m doing fallacious?