使用Android SDK对API Gateway请求进行签名

0

【以下的问题经过翻译处理】 有关使用Android AWS SDK进行HTTP请求的文档,特别是当API Gateway端点使用IAM授权者时需要使用AWS凭证签署请求的情况吗?我正在使用Retrofit作为HTTP客户端,但如果需要的话可以切换到使用SDK或其他客户端来发出请求。我找不到任何说明如何签署请求的文档。除了文档外,是否有可用的代码示例?

profile picture
EXPERT
demandé il y a 6 mois3 vues
1 réponse
0

【以下的回答经过翻译处理】 你可以尝试使用为你的API生成的Android SDK吗?你可以通过访问API Gateway控制台,进入你的API,然后进入你想要生成的阶段(通常是 "Prod"),然后转到 "SDK Generation" 选项卡。你可以选择Android作为平台。

SDK将为你生成用于与你的API通信的类(包括如果你的API设置为使用AWS_IAM进行授权的情况),并且readme.md文件中将包含示例代码。

类似于这样:

ApiClientFactory factory = new ApiClientFactory();
// create a client
final WebApiChallengeClient client = factory.build(WebApiChallengeClient.class);
profile picture
EXPERT
répondu il y a 6 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions