How can I get authorization token from browser intent?

前端 未结 1 1599
遇见更好的自我
遇见更好的自我 2021-01-16 02:21

Sorry for my bad English, I\'ll try to explain my problem as simple as I can. I\'m trying to make an app, which works with Yandex API. On their help page, I\'ve read that yo

相关标签:
1条回答
  • 2021-01-16 03:00

    You can get the Uri in onNewIntent. Just override it in your Activity. You can get the access token with something like the following:

    @Override
    protected void onNewIntent (Intent intent){
      Uri uri = intent.getData();
      if (uri!=null){
        String mainPart = uri.toString().split("#")[1];
        String[] arguments = mainPart.split["&"];
        String argument = arguments[0];
        String token = argument.split("=")[1];
    }
    
    0 讨论(0)
提交回复
热议问题