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

Question about the callback activity #18

Closed
GroovinChip opened this issue Sep 6, 2018 · 11 comments
Closed

Question about the callback activity #18

GroovinChip opened this issue Sep 6, 2018 · 11 comments

Comments

@GroovinChip
Copy link

<activity android:name="clancey.simpleauth.simpleauthflutter.SimpleAuthCallbackActivity" >
            <intent-filter android:label="simple_auth">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="com.googleusercontent.apps.992461286651-k3tsbcreniknqptanrugsetiimt0lkvo" />
            </intent-filter>
        </activity>

Is this what will take the user back to the app once they've authenticated? I'm trying to make my ap deep-linked so that when a user authorizes the app to connect to their GitHub account they get returned to the app rather than stay in the browser.

@Clancey
Copy link
Owner

Clancey commented Sep 6, 2018

So some providers like google require a specific callback. But for things like Github, you can create your own. foo.githubcallback.myapp or really whatever string you want! Not sure if github requires specific callbacks. But if it does, you just register that as a callback foo.githubcallback.myapp://

@Clancey Clancey closed this as completed Sep 6, 2018
@GroovinChip
Copy link
Author

I tried using a custom string (I used my app's package name) in both the githubApi object and in the settings for my GitHub Oauth app. I got errors in the console like that. Any suggestions?

@Clancey
Copy link
Owner

Clancey commented Sep 6, 2018

Can you paste the console output?

@GroovinChip
Copy link
Author

Console output:

E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): Failed to handle method call
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): java.lang.IllegalArgumentException: Unsupported value: java.net.URISyntaxException: Expected authority at index 45: com.groovinchip.fluttercommunitychallenges://
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at io.flutter.plugin.common.StandardMessageCodec.writeValue(StandardMessageCodec.java:293)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at io.flutter.plugin.common.StandardMethodCodec.encodeErrorEnvelope(StandardMethodCodec.java:70)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.error(MethodChannel.java:199)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at clancey.simpleauth.simpleauthflutter.SimpleAuthFlutterPlugin.onMethodCall(SimpleAuthFlutterPlugin.java:63)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:191)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at io.flutter.view.FlutterNativeView.handlePlatformMessage(FlutterNativeView.java:163)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at android.os.MessageQueue.next(MessageQueue.java:326)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at android.os.Looper.loop(Looper.java:160)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at android.app.ActivityThread.main(ActivityThread.java:6669)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
E/MethodChannel#simple_auth_flutter/showAuthenticator(13047): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

Code:

  final simpleAuth.GithubApi githubApi = simpleAuth.GithubApi(
    "github", "***",
    "***",
    "com.groovinchip.fluttercommunitychallenges://",
    scopes: [
      "user",
      "repo",
      "public_repo",
    ],
  );

@Clancey
Copy link
Owner

Clancey commented Sep 6, 2018

Does this happen when the UI is presented? Or after you login?

@GroovinChip
Copy link
Author

it happens when I tap a button to log in

@GroovinChip
Copy link
Author

GroovinChip commented Sep 6, 2018

Basically the button is supposed to launch the GitHub authorization, and once the app is authorize a FirebaseUser will be created with user information that returns. Haven't implemented that yet.

@Clancey
Copy link
Owner

Clancey commented Sep 6, 2018

My mistake on the redirect com.groovinchip.fluttercommunitychallenges:/ only one / vs //

@GroovinChip
Copy link
Author

GroovinChip commented Sep 6, 2018

now a blank webpage shows up instead of the github authentication, so weird. Do I only use com.groovinchip.fluttercommunitychallenges:/ in my application or on the github side as well? Or vice versa?

@Clancey
Copy link
Owner

Clancey commented Sep 6, 2018

That shouldn't matter. Blank page cloud be internet issue. I tested on my emulator and I got the log in page even with bogus data

@GroovinChip
Copy link
Author

What's your backend configuration though? Do you use the same string from the code on the github side of things?

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