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

linkedin sign in issue #298

Open
cheekuji opened this issue Oct 29, 2016 · 11 comments
Open

linkedin sign in issue #298

cheekuji opened this issue Oct 29, 2016 · 11 comments

Comments

@cheekuji
Copy link

I was able to bring up the login page for linked in but when I hit cancel instead of submitting the credentials I get the following message:
{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : authorization code not found","error":"invalid_request"}

Another problem is I can only signin via android. Whenever I use iphone I ge the same message above:
{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : authorization code not found","error":"invalid_request"}

@nraboy
Copy link
Owner

nraboy commented Nov 3, 2016

A few questions:

  1. Are you using the latest version of the library?
  2. Have you configured LinkedIn via the LinkedIn dashboard to be a web application, not Android and iOS?
  3. Have you provided all the necessary information in the command (state, client id, etc.)?

Best,

@cheekuji
Copy link
Author

cheekuji commented Nov 4, 2016

I am using latest version of ngcordova
Yes I have, I can login via Android.
All information is there.

Even with android I can see a page not found error for a split second and it goes away for ios I jiust cannot login at all.

From xcode logs I see this error:
webView:didFailLoadWithError - -1004: Could not connect to the server.

@cheekuji
Copy link
Author

cheekuji commented Nov 5, 2016

I update the in app browser now I cannot login at all.
I get this error: The sign in flow was canceled

@nraboy
Copy link
Owner

nraboy commented Nov 6, 2016

Are you using ng-cordova or ng-cordova-oauth? They are not the same. My library, ng-cordova-oauth, has no affiliation with what Ionic has produced.

On iOS you need to enable ATS. Because LinkedIn uses explicit grants you will always see for a moment an error screen for both Android and iOS. Only way to prevent this is to host your own redirect url.

@AdrienDC
Copy link

Got the same error "The sign in flow was canceled" since Angular 1.6.X. Works like a charm with Angular 1.5.11 and InAppBrowser 1.7.0

@nraboy
Copy link
Owner

nraboy commented Jun 19, 2017

Is this still an issue?

@AdrienDC
Copy link

Yes still

@DhavalW
Copy link

DhavalW commented Sep 28, 2017

+1
facing the issue 'Sign in flow was cancelled'

@DhavalW
Copy link

DhavalW commented Sep 28, 2017

@nraboy
did some digging and found the problem on line 1173. At least for the linkedIn login.

      `var browserRef = window.cordova.InAppBrowser.open('https://www.linkedin.com/uas/oauth2/authorization?client_id=' + clientId + '&redirect_uri=' + redirect_uri + '&scope=' + appScope.join(" ") + '&response_type=code&state=' + state, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes');

`

I removed the appScope.join() bit and changed it to

    `  var browserRef = window.cordova.InAppBrowser.open('https://www.linkedin.com/uas/oauth2/authorization?client_id=' + clientId + '&redirect_uri=' + redirect_uri + '&response_type=code&state=' + state, '_blank', 'location=no,clearsessioncache=yes,clearcache=yes');

`

Now it works fine. Returns a valid token, though there's brief & ugly error page that flickers just before it closes.

Does this have anything to do with the fact that you need URL encoded strings for the scope ?

@nraboy
Copy link
Owner

nraboy commented Sep 29, 2017

It could be the reason.

You do need scope otherwise you cannot define the permissions which will lead to other problems. Even though it worked for you, I'm sure you'll run into issues without the scope.

In terms of the flicker, it is because it is an explicit grant which is two step (get code and request access token) rather than an implicit grant (request access token). It is a race condition. You can make it a little more attractive by overriding the localhost with a real website.

I'm open to pull requests if you think you have a fix to all this.

@DhavalW
Copy link

DhavalW commented Sep 30, 2017 via email

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

4 participants