[Cloud Anchors Management API] When Using Cloud Anchors Management API in Windows

APP 2021. 7. 2. 14:25

Conclusion> Don't use Powershell or cmd. Use Git Bash.

 

 

I followed this page's instruction to manage Cloud Anchors.

https://developers.google.com/ar/develop/platform-agnostic/cloud-anchors/management-api

 

Cloud Anchors Management API  |  ARCore  |  Google Developers

Cloud Anchors Management API를 사용하여 ARCore 앱 외부에서 Cloud Anchors를 관리합니다. 시작하기 작업 예 입증 Google Cloud Platform 콘솔 에서 서비스 계정 키를 만들고 인증 메커니즘으로 OAuth2 토큰을 생성합

developers.google.com

 

I used windows powershell, cmd. When I request this for List all Cloud Anchors.

 

export BEARER_TOKEN=`(oauth2l fetch --json creds.json arcore.management)`
curl -H "Authorization: Bearer $BEARER_TOKEN" https://arcorecloudanchor.googleapis.com/v1beta2/management/anchors?page_size=50&order_by=last_localize_time%20desc

 

I GOT ERROR MESSAGE

Invoke-WebRequest : 'Headers' 매개 변수를 바인딩할 수 없습니다. "System.String" 유형의 "Authorization: Bearer " 값을 "S
ystem.Collections.IDictionary" 유형으로 변환할 수 없습니다.
위치 줄:2 문자:9
+ curl -H "Authorization: Bearer $BEARER_TOKEN" https://arcorecloudanch ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

 

 

I tried about 5 hours to fix this error.

 

but solution was simple.  Use Git Bash.

 

: