将Ory集成到本机Android应用程序中的方法是什么?

huangapple go评论58阅读模式
英文:

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 将Ory集成到本机Android应用程序中的方法是什么?

英文:

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 将Ory集成到本机Android应用程序中的方法是什么?

huangapple
  • 本文由 发表于 2023年5月22日 05:59:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/76302088.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定