I am unable to add the header successfully using
// create a custom header
val header: io.grpc.Metadata = io.grpc.Metadata()
val auth: io.grpc.Metadata.Key<String> = io.grpc.Metadata.Key.of("authorization", io.grpc.Metadata.ASCII_STRING_MARSHALLER)header.put(auth, "barer "+ AWSMobileClient.getInstance().tokens.idToken.tokenString);
Stub = io.grpc.stub.MetadataUtils.attachHeaders(Stub, header)
as suggested by Android How to add a custom header in grpc client?.
I get: onError: io.grpc.StatusRuntimeException: UNAVAILABLE
in IOS I was able to make it work using:
let authToken = "\(AWSCognitoUserPoolsSignInProvider.sharedInstance().getUserPool().token().result ?? "")"
let httpHeader: [(String, String)] = [("Authorization", authToken)]
let header = HPACKHeaders(httpHeader)
callOptions = CallOptions(customMetadata: header, timeLimit: .none, messageEncoding: .disabled , requestIDProvider: .none, requestIDHeader: nil, cacheable: false)
let req = Cilix_Api_GetVersionRequest()
let request = self.client?.getVersion(req, callOptions: callOptions)
any advice will be appreciated