Giter Club home page Giter Club logo

line-login-starter's Introduction

LINE Login Starter Application

Build Status

This is a starter application to help you get started on integrating LINE Login into a web app or website. This sample Java application demonstrates how you can use LINE Login to let users log in to your app with their LINE accounts and to get user information.

The following instructions describe how to deploy the app on Heroku, view logs, and modify the app for yourself.

Requirements

  • A LINE Login channel with the "WEB" app type. To create a channel, go to Creating a Channel on the LINE Developers site.
  • A Heroku account (free to create)

Deploy the app on Heroku

Deploy

With the "Deploy to Heroku" button, you can easily deploy the LINE Login starter application to Heroku from your web browser by following the steps below.

  1. Click the Deploy to Heroku button to go to the Heroku Dashboard to configure and deploy the app.
  2. Enter a Heroku app name (optional).
  3. Enter the following Heroku config variables.
    • Channel ID: Found in the "Channel settings" page in the console
    • Channel secret: Found in the "Channel settings" page in the console
    • Callback URL: https:// + "Heroku app name" + .herokuapp.com/auth
  4. Click the Deploy button. Heroku then deploys this repository to a new Heroku app on your account.

Configure your app in the console

Set the callback URL in the "App settings" page of the LINE Developers console.

Run the app in a browser

When you successfully log in with your LINE credentials, the app displays your LINE user profile image, display name, and status message. Note that you will be logged in automatically if you are logged in to the LINE app on your iOS or Android device.

  1. Go to the URL of your app to open up the LINE Login dialog. https:// + {Heroku app name} + .herokuapp.com
  2. Log in to LINE and agree to grant the required permissions to the app

Try out other features of the starter app

Once you have logged into the app, you can select the following buttons to try out other features of this app.

  • Verify the user access token
  • Refresh the user access token
  • Log out the user (revoke the access token)

View logs

To get more information, you can check the logs of your app using [Heroku CLI][heroku-cli].

  1. Log in to Heroku from the command line

    $ heroku login
  2. View the logs. For more information, see View logs.

    $ heroku logs --app {Heroku app name} --tail

Download and make changes to the starter app

You can download the starter app to your local machine to test and make changes for yourself. You can then deploy the app to a web server of your choice. Here, we'll look at how to make and deploy changes to the Heroku app you created in the previous step.

  1. Make sure you have the following installed

    • JDK 1.8 or higher installed
    • Maven 3.0 or higher installed
    • Git
  2. Clone this GitHub repository.

    git clone https://github.com/line/line-login-starter.git
  3. cd into your Git directory

  4. Add a remote for Heroku to your local repository

    $ heroku git:remote -a {Heroku app name}
  5. Make edits and commit changes (optional)

    $ git add .
    $ git commit -m "First commit"
  6. Push changes to Heroku master

    $ git push heroku master

Other resources

For more information on how to integrate LINE Login with your existing web app, see Integrating LINE Login with your web app.

line-login-starter's People

Contributors

cosmic-cowboy avatar guitarsucks avatar kosukekamiya avatar mrexmelle avatar ryotaro-furuki avatar shuji-mitsuya avatar youhei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

line-login-starter's Issues

Can not run this project on heroku

Is this project up-to-date ?
I had up load this project to heroku and added keroku parameter by README
but when I try login by my line account. It's always return error
errorMessage=AUTHENTICATION_FAIL&errorCode=401&error=server_error
How can I test line login or resolve this issue ?

LINE login for web

Hello,
I saw the document under line login that login authentication is available for web. I would like to know how the login feature works. It seems like I have to ask for an access token and then I retrieve user information through teh token. However, there seems to be a CORS issue if we were to fetch the information. I just want to know what is the correct flow to get the login feature works.
I am using javascript framework to implement this.

Thank you so much.

How can I get the real userID from mid?

I am using line login api to get user profile. I got mid of user for account and also displayname. But those cannot be used to add friend to line app

I try to use result of user profile to construct line.me/ti/p/~{id} link and it cannot work with any of them

Are there any API to get userID from mid?

a999999

	       "description": "Channel secret",
   "required": true
 },
  • "LINECORP_PLATFORM_CHANNEL_CALLBACKURI": {
  •  "description": "Callback URI",
    
  • "LINECORP_PLATFORM_CHANNEL_CALLBACKURL": {
  •  "description": "Callback URL",
     "required": true
    
    }
    }
    src/main/java/com/linecorp/sample/login/infra/line/api/v2/LineAPI.java
    @@ -39,7 +39,7 @@
    @field("grant_type") String grant_type,
    @field("client_id") String client_id,
    @field("client_secret") String client_secret,
  •        @Field("redirect_uri") String callback_uri,
    
  •        @Field("redirect_uri") String callback_url,
           @Field("code") String code);
    

    @headers("Content-Type: application/x-www-form-urlencoded")
    src/main/java/com/linecorp/sample/login/infra/line/api/v2/LineAPIService.java
    @@ -42,15 +42,15 @@
    private String channelId;
    @value("${linecorp.platform.channel.channelSecret}")
    private String channelSecret;

  • @value("${linecorp.platform.channel.callbackUri}")
  • private String callbackUri;
  • @value("${linecorp.platform.channel.callbackUrl}")

  • private String callbackUrl;

    public AccessToken accessToken(String code) {
    return getClient(t -> t.accessToken(
    GRANT_TYPE_AUTHORIZATION_CODE,
    channelId,
    channelSecret,

  •            callbackUri,
    
  •            callbackUrl,
               code));
    
    }

@@ -76,16 +76,16 @@ public Profile profile(final AccessToken accessToken) {

 public String getLineWebLoginUrl(String state) {
  •    final String encodedCallbackUri;
    
  •    final String encodedCallbackUrl;
       try {
    
  •        encodedCallbackUri = URLEncoder.encode(callbackUri, "UTF-8");
    
  •        encodedCallbackUrl = URLEncoder.encode(callbackUrl, "UTF-8");
       } catch (UnsupportedEncodingException e) {
           throw new RuntimeException(e);
       }
    
       return "https://access.line.me/dialog/oauth/weblogin?response_type=code"
               + "&client_id=" + channelId
    
  •            + "&redirect_uri=" + encodedCallbackUri
    
  •            + "&redirect_uri=" + encodedCallbackUrl
               + "&state=" + state;
    
    }

The example does not take clock skew into account.

I encounter a case where the "issued at" time returned in JWT response by the server is earlier than the time generated in the client side. It does not always happen, but it's pretty often.

I attached the log in the following picture. It indicates three seconds difference between server and client times, and it yields an error message: The token can't be used before Tue Apr 17 11:32:42 WIB 2018.

clock_skew

How to upgrade Line Login from 1.0 to 2.0

Hi,
As we all know, Line Login 1.0 will return mid for each user, as the same time 2.0 return userId.
My site used to use mid to identify the user . But when upgrade to 2.0, I can not distinguish between old users. How can I get the real userId from mid? Or how can I get the mid from userId.

I'm getting 404, token not found

I don't actually use your code however; I use it as a reference to build my own OAuth which utilize line login for signin at c# webapi. Can you please help me out ? why do I get 404 Token not found event though I have supplied all the required params ?

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.