英文:
How would one integrate Ory into a native Android app?
问题
如何将 Ory 集成到本机Android应用程序中?是否有可用的Android SDK,我错过了吗?还是真的必须从头开始实现,包括所有PKCE等内容?
英文:
How can one integrate Ory into a native Android app? Is there any Android SDK available that I missed or does one really have to implement this from scratch with all the PKCE stuff etc?
答案1
得分: 1
First, I search the last version on https://mvnrepository.com/search?q=ory
Then, I used the gradle version from https://mvnrepository.com/artifact/sh.ory/ory-client/1.1.31
implementation group: 'sh.ory', name: 'ory-client', version: '1.1.31'
And then, I used this sample
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://playground.projects.oryapis.com");
// Configure HTTP bearer authorization: oryAccessToken
HttpBearerAuth oryAccessToken = (HttpBearerAuth) defaultClient.getAuthentication("oryAccessToken");
oryAccessToken.setBearerToken("BEARER TOKEN");
CourierApi apiInstance = new CourierApi(defaultClient);
String id = "id_example"; // String | MessageID is the ID of the message.
try {
Message result = apiInstance.getCourierMessage(id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CourierApi#getCourierMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
from https://github.com/ory/sdk/blob/master/clients/client/java/README.md#installation
and it worked
Note: There is also a link where you can find all the Ory SDKs
https://www.ory.sh/docs/sdk
Hope I helped with your problem
英文:
First, I shearch the last version on
https://mvnrepository.com/search?q=ory
Then, I used the gradle version from https://mvnrepository.com/artifact/sh.ory/ory-client/1.1.31
implementation group: 'sh.ory', name: 'ory-client', version: '1.1.31'
And then, I used this sample
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("https://playground.projects.oryapis.com");
// Configure HTTP bearer authorization: oryAccessToken
HttpBearerAuth oryAccessToken = (HttpBearerAuth) defaultClient.getAuthentication("oryAccessToken");
oryAccessToken.setBearerToken("BEARER TOKEN");
CourierApi apiInstance = new CourierApi(defaultClient);
String id = "id_example"; // String | MessageID is the ID of the message.
try {
Message result = apiInstance.getCourierMessage(id);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CourierApi#getCourierMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
from https://github.com/ory/sdk/blob/master/clients/client/java/README.md#installation
and it worked
Note: There is also a link where you can find all the Ory SDKs
https://www.ory.sh/docs/sdk
Hope I helped with your problem
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论