Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native null pointer exception for JIRA provider (Java). #234

Open
TeunKooijman opened this issue Nov 6, 2018 · 3 comments
Open

Native null pointer exception for JIRA provider (Java). #234

TeunKooijman opened this issue Nov 6, 2018 · 3 comments

Comments

@TeunKooijman
Copy link

When trying to add a provider for JIRA OAuth 1.0, the native Java code crashes on a Null Pointer Exception on oauth10aService.getRequestToken() (line 240 in OAuthManagerFragmentController$LoadRequestTokenTask).

The stack trace is as follows:

java.lang.RuntimeException: An error occurred while executing doInBackground()
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at android.os.AsyncTask$3.done(AsyncTask.java:318)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:242)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:243)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:762)
11-06 15:49:40.158 25802 25951 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.github.scribejava.core.model.OAuth1RequestToken com.github.scribejava.core.oauth.OAuth10aService.getRequestToken()' on a null object reference
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at io.fullstack.oauth.OAuthManagerFragmentController$LoadRequestTokenTask.doInBackground(OAuthManagerFragmentController.java:240)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at io.fullstack.oauth.OAuthManagerFragmentController$LoadRequestTokenTask.doInBackground(OAuthManagerFragmentController.java:226)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at android.os.AsyncTask$2.call(AsyncTask.java:304)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-06 15:49:40.158 25802 25951 E AndroidRuntime:        ... 4 more

The provider is added and configured as follows:

     this.manager = new OAuthManager("My-App-Name");
     this.manager.addProvider({
            jira: 
            {
                auth_version: '1.0',
                authorize_url: 'https://my-hosted-jira-name.atlassian.net/plugins/servlet/oauth/authorize',
                access_token_url: 'https://my-hosted-jira-name.atlassian.net/plugins/servlet/oauth/access-token',
                request_token_url: "https://my-hosted-jira-name.atlassian.net/plugins/servlet/oauth/request-token",
                callback_url: () => "http://localhost/jira",
                api_url: 'https://my-hosted-jira-name.atlassian.net/rest/api/2',
            }
        })
        this.manager.configure({
            jira: {
                client_id: 'My Consumer Key',
                client_secret: 'my-secret-private-key-that-I-removed-for-security'
            }
        });

And then the authorization is kicked-off by calling:

    authorize = async () =>
    {
        try
        {
            const response = await this.manager.authorize('jira');
            console.log("RESPONSE: " + JSON.stringify(response));
        }
        catch(e)
        {
            console.log("ERROR: " + JSON.stringify(e));
        }
    }

Any help trying to figure out what is going on is greatly appreciated, so thanks in advance!

@TeunKooijman
Copy link
Author

Upon closer inspection the problem seems to be in the static public OAuth10aService getApiFor10aProvider() method in OAuthManagerProviders.java on line 42. Where getApiFor20Provider() actually has a fall through leading to returning a call to OAuthManagerProviders.configurableService(), the 1.0a version falls through to returning null instead.

Was this intentional? If not, is there any chance this could be fixed soon?

The screenshot below shows exactly what I mean:

image

@ahmedtehseen
Copy link

@TeunKooijman did you solve this issue.?

@ahmedtehseen
Copy link

I'm having same problem with facebook provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants