mfpdev / social-login-sample

0 stars 2 forks source link

google login #1

Closed apps4u closed 8 years ago

apps4u commented 8 years ago

Hi Ive installed the two adapters and configured google service Ive include the google-service.json file in the app folder and Ive added the Oauth2 web app client id to the strings file and the same key to the adapter in the MFP console,

Now I can click the button to login to google and it works but when I click the "call protected adapter" button i get a error with a status code of "Google Sign In failed Status{statusCode=unknown status code: 12501, resolution=null}"

Ive included a image Ive added the "Web Client 1" key to the android app strings file and adapter in the MFP console.

screen shot 2016-07-31 at 5 09 54 am

ishaiborovoy commented 8 years ago

Hi, The key in the adapter needs to be a web client key and the one in the strings.xml needs to be the Android client. You wrote you use the same key which will could be the reason for the issue? The web client will use in the security check to check that token sent by the client is valid token.

Regards, Ishai Borovoy

apps4u commented 8 years ago

yes I did I thought that was wrong I must of missed read the doc's as it said to use the web key. I'll give it a go thanks.

IdanAdar commented 8 years ago

Please re-open if you continue to experience this issue.

apps4u commented 8 years ago

HI Im still having issue's Facebook work fine.

So in the picture the two keys at the top I don;t use then the two OAuth 2 client_ids I use the android one in the android strings file and the web client "client id" I used in the console for the social login adapter.

screen shot 2016-08-07 at 2 24 09 am

The services.json file is in place and I'm running the current mobile-first-idk.

apps4u commented 8 years ago

08-07 01:27:31.501 6724-6821/social.sample.ibm.com.sociallogin E/com.github.mfpdev.sample.sociallogin: SocialMainActivity.onActivityResult in SocialMainActivity.java:121 :: unable to login to google service

Thats what I get in the android simulator console. I have two google accounts that are setup on that simulator I have just created a standard android project (not using MFP) and enabled Google Auth and I can login to google using the test app but not using Mobile-first. I get the same error in my project as I do in this sample. So it not my account or simulator.

And I'm running mobile first server on my mac it's the dev server and current download from MFP site.

apps4u commented 8 years ago

I just wanted to add that I think its in the client side SDK as Ive tried to debug the Adapter and I won't hit any break points in the Google Handler class. I hit break points when debugging the Facebook login.

I also don't get any request in the Analytics dashboard when using google login. So the error is client side before sending request to adapter.

Please let me know if you want any more info if you can not reproduce the same error as me.

apps4u commented 8 years ago

The README said to use the web client "client_id" in the Android strings file I tried both first the android "client_id" in the strings file and the web client "client_id" in the adapter then I try the web client "client_id" in the Adapter and the android strings file . Ive tried all combination of the two keys and none seem to work as your first reply said to use Android "client_id" and the README was different thats why I tried all combo's

Also I'm using the OAuth "client_id" not the secret key.

apps4u commented 8 years ago

This is my Gradle file. I read online that people had to create to oauth2 clients one using the debug keystore sha1 and one using the release keystore now I didn't create the release as Ive not created a keystore for release. So I tried to just add the debug.keystore to my gradle build file.

apply plugin: 'com.android.application'

repositories {
    jcenter()
}

android {
    signingConfigs {
        config {
            keyAlias 'androiddebugkey'
            storeFile file('/Users/jasonkristian/.android/debug.keystore')
        }
    }
    compileSdkVersion 24
    buildToolsVersion "24.0.1"
    defaultConfig {
        applicationId "social.sample.ibm.com.sociallogin"
        minSdkVersion 23
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
        signingConfig signingConfigs.config
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

    }
    packagingOptions {
        pickFirst 'META-INF/ASL2.0'
        pickFirst 'META-INF/LICENSE'
        pickFirst 'META-INF/NOTICE'
    }
    productFlavors {
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.jayway.jsonpath:json-path:2.2.0') {
        exclude group: 'org.ow2.asm'
    }
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.google.android.gms:play-services-auth:9.2.0'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.ibm.mobile.foundation:ibmmobilefirstplatformfoundation:8.0.+'
    compile 'com.google.android.gms:play-services-appindexing:9.2.0'
    compile 'de.hdodenhof:circleimageview:2.0.0'
}

This is a link to the stack overflow page for the error I'm getting

[http://stackoverflow.com/questions/33583326/new-google-sign-in-android]

apps4u commented 8 years ago

If you want I'm happy to give you my Google service file and the key's as I can delete latter so just let me know and I'll email to you the keys.

ishaiborovoy commented 8 years ago

Hi, I will happy to assist you, you can send me the keys to ishaib@il.ibm.com. You said you succeed with a standalone project (without MobileFirst), did you work with the web key on the server in the standalone project? Could be that you need to verify your account before using the web key? Or maybe you need to turn on APIs?

Anyway send me your keys and I can try to figure out what is the issue.

Regards, Ishai Borovoy

ishaiborovoy commented 8 years ago

Another q to verifying all set: Did you put the secret of the webkey in the security check settings?

apps4u commented 8 years ago

which setting in the adapter ?? in MFP console. ?

apps4u commented 8 years ago

I put the web client id I did not put any of the secret key's any where , Where am I meant to put it.?? screen shot 2016-08-10 at 1 00 22 am

ishaiborovoy commented 8 years ago

That's OK. Another thing I realized, in mistake I forgot the old client id - social.sample.ibm.com.sociallogin So if you already create Android package for com.github.mfpdev.sample.sociallogin, just change it in the build.gradle of the app:

defaultConfig { applicationId "com.github.mfpdev.sample.sociallogin" minSdkVersion 23 targetSdkVersion 23 versionCode 1 versionName "1.0" }

apps4u commented 8 years ago

Im sorry I looked at the package name like 3 times I don't know how I missed it. That was one if the first things I looked at. :)

apps4u commented 8 years ago

I had to re create my app in the MFP console . as I changed the app id in the Gradle file but after doing that and removing the old app from device I still can not login to google so . let me just clone a fresh version from git and try again

apps4u commented 8 years ago

Thanks you so much for your help I was still unable to login even those I removed the app from device . But I just wiped the device and started again and now I can login so Thanks for your help . You have gone above and beyond. So thanks I really like MFP its the perfect product from some of my clients and Now I can get a sample up and running with social auth working so I can get them to agree to move there apps so thanks again.

ishaiborovoy commented 8 years ago

You are welcome :-)