Skip to content Skip to sidebar Skip to footer

How Can I Get Authorization Token From Browser Intent?

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 you should l

Solution 1:

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];
}

Post a Comment for "How Can I Get Authorization Token From Browser Intent?"