Code Monkey home page Code Monkey logo

Comments (10)

leshik avatar leshik commented on August 10, 2024

@moberwasserlechner For now, I tried to login on iOS using the code similar to Google, but struggle to figure out how/what to set for redirect custom scheme (it replies with 400. Bad Request.)
Also I wonder how to make it to redirect to the app instead of just web page. Maybe you have some hints...

from generic-oauth2.

moberwasserlechner avatar moberwasserlechner commented on August 10, 2024

Hi @leshik,

Unfortunatley I never heard of LINE before but if it is a valid oauth2 provider it should work.

  1. Does it work in a pwa using this plugin?
  2. Have registered your custom scheme at the provider's registration page?
  3. Could you please share your config (without the appId or any other secret data)?
  4. Is there anything non standard in the LINE flow?

The idea of this plugin to be as generic as possible and let you configure oauth2 providers instead of integrating the various providers with a special API.

from generic-oauth2.

leshik avatar leshik commented on August 10, 2024

@moberwasserlechner Unfortunately we don't have the PWA version of the app, so I have to make it work with iOS and Android versions. I've set up the configuration options at LINE's side (except the Callback URL as I want it to redirect into the app) as per their documentation, using the app bundle identifier in place of iOS/Android scheme. Then tried the code similar to your Google example in Safari console after starting the app:

Capacitor.Plugins.OAuth2Client.authenticate({
  appId: "XXXXXXXXXX", // LINE channel id
  authorizationBaseUrl: "https://access.line.me/oauth2/v2.1/authorize",
  accessTokenEndpoint: "https://api.line.me/oauth2/v2.1/token",
  scope: "profile",
  resourceUrl: "https://api.line.me/v2/profile",
  ios: {
    responseType: "code",
    customScheme: "myapp.bundle.id:/"
  }
})

Of course, it didn't work with the error that I've mentioned before. The reason, obviously, is that redirect_uri is the required parameter:

image

(state is also required, but I understand how to deal with it).

Is it correct that I need to include their SDK and write a customHandler if I want it to authenticate through their app instead of webview? Anyway, I have no idea what to do with the redirect_uri requirement.

from generic-oauth2.

moberwasserlechner avatar moberwasserlechner commented on August 10, 2024

For state there is a option. see https://github.com/moberwasserlechner/capacitor-oauth2/blob/master/src/definitions.ts#L54

Maybe I can introduce a new parameter ios.redirect_url beside the customScheme.

I have to look closer but don't have the time right now.

If they do not allow redirecting to the app like google oauth does and they force you to use their SDK you might have to choose the Facebook approach.

from generic-oauth2.

leshik avatar leshik commented on August 10, 2024

I was able to make it work on iOS with their SDK, but struggle with Android. Contrary to what Facebook API provide, seems that Line API doesn't have any ready-to-use activity that can be integrated.

from generic-oauth2.

leshik avatar leshik commented on August 10, 2024

@moberwasserlechner Here I found the implementation for Cordova, but could you please advise on how to deal with the OAuth2CustomHandler?

from generic-oauth2.

moberwasserlechner avatar moberwasserlechner commented on August 10, 2024

Sry that I did not had the time to help you further. Did you solve it or is it still an issue?

from generic-oauth2.

leshik avatar leshik commented on August 10, 2024

Well, it's still an issue but not of high priority right now, and surely it's due to my lack of knowledge on Android programming. I hope somebody in our team with Java background would help me to solve it, and I will share the solution then once it's available.

from generic-oauth2.

moberwasserlechner avatar moberwasserlechner commented on August 10, 2024

Thanks for that in advance. :)

from generic-oauth2.

moberwasserlechner avatar moberwasserlechner commented on August 10, 2024

I close this for now as it might be solved with v2.0.0.

from generic-oauth2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.