question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Android: My own providers are not supported yet?

See original GitHub issue

I’ve implemented iOS app for my own oauth provider with rn-oauth. It works as I expected.

But on Android, it doesn’t. I got following error on OAuthManager#authorize().

04-09 22:22:55.143  5149  5189 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.github.scribejava.core.oauth.OAuth20Service.getAuthorizationUrl()' on a null object reference

So I read some code, found this static method, and it seems additional providers are not cosidered on Android.

  static public OAuth20Service getApiFor20Provider(
    final String providerName,
    final HashMap params,
    @Nullable final ReadableMap opts,
    final String callbackUrl
  ) {
    if (providerName.equalsIgnoreCase("facebook")) {
      return OAuthManagerProviders.facebookService(params, opts, callbackUrl);
    } else if (providerName.equalsIgnoreCase("google")) {
      return OAuthManagerProviders.googleService(params, opts, callbackUrl);
    } else if (providerName.equalsIgnoreCase("github")) {
      return OAuthManagerProviders.githubService(params, opts, callbackUrl);
    } else if (providerName.equalsIgnoreCase("slack")) {
      return OAuthManagerProviders.slackService(params, opts, callbackUrl);
    } else {
      return null;
    }
  }

Not supported yet on Android ? Or there is the way to get my own provider work?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
pi-chancommented, May 30, 2017

Thank you vbuch, your code almost works! I’ll continue to try detailed test.

0reactions
monolithedcommented, Jan 28, 2018

The problem is solved in accessTokenResponse of OAuthManagerModule.java:

      String callbackUrl = (String) cfg.get("callback_url");

      if (callbackUrl == null) {
        callbackUrl = "http://localhost/" + providerName;
      }
Read more comments on GitHub >

github_iconTop Results From Across the Web

My application relies Google play services, which is not ...
Possible solution: Make sure you are using the latest version of Google Play Service & most importantly your Play Services isn't disabled.
Read more >
Fix an installed Android app that isn't working - Google Support
Try the following steps if an app installed on your phone has any of these problems: Crashing. Won't open. Won't respond. Isn't working...
Read more >
Device compatibility overview - Android Developers
As an app developer, you don't need to worry about whether a device is Android compatible, because only devices that are Android compatible...
Read more >
Frequently asked questions | Android Open Source Project
This page provides answers to some frequently asked questions (FAQs). Open Source. What is the Android Open Source Project?
Read more >
Content provider basics | Android Developers
This topic covers the basics of working with existing content providers. To learn more about implementing content providers in your own ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found