【问题标题】:Coinbase oauth 2.0 redirect uri androidCoinbase oauth 2.0 重定向 uri android
【发布时间】:2018-05-04 15:44:08
【问题描述】:

我正在尝试在我的 android 应用中设置 coinbase v2 oauth 身份验证。 我需要设置重定向 uri,以便当用户授权访问 coinbase 时可以将响应重定向到我的应用程序。

我的问题是在 coinbase api 设置中使用什么来重定向 uri 以及在我的应用程序中使用什么(发送请求时的意图过滤器 + 重定向 uri)

有人可以帮我吗? :)

提前致谢

【问题讨论】:

    标签: android coinbase-api


    【解决方案1】:

    例如;假设您的应用名称是 foo

    在 Coinbase 设置的重定向 URL 上使用下面的 url

    com.foo.fooV1://coinbase-oauth
    

    并在应用中处理

    在您用于处理重定向 url 的 Activity 的 onCreate 处,获取 Intent

    Intent i = getIntent();
    
    if(i != null && i.getData() != null){
    
       String uri = i.getData().toString();
    
       if (uri.contains("coinbase-oauth")){
          String[] arr = uri.split("code=");
          String code = arr[1];
    
       }
    
    }
    

    【讨论】:

    • 感谢您的回答。如果我的应用名称是 foo 什么是 fooV1?类名?
    • @tiagocarvalho92 No. V1 只是一个例子。它可以是 com.foo.fooV1 或 com.foo.fooV2 或 com.foo.fooApp.. 你想要什么。
    猜你喜欢
    • 2013-11-19
    • 2012-07-05
    • 1970-01-01
    • 2021-11-21
    • 1970-01-01
    • 1970-01-01
    • 2021-07-09
    • 2019-03-21
    • 1970-01-01
    相关资源
    最近更新 更多