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

feat: document LINE social sign-in provider #2006

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions docs/kratos/social-signin/98_line.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
---
id: line
title: Add LINE as a social sign-in provider in Ory
sidebar_label: LINE
---

# LINE

```mdx-code-block
import JsonnetWarning from "../../_common/jsonnetwarning.mdx"
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs groupId="default">
<TabItem value="console" label="Ory Console" default>

Follow these steps to add LINE as a social sign-in provider to your project using the Ory Console:

1. Go to <ConsoleLink route="project.socialSignIn" />.
2. Click the switch next to the LINE logo to start the configuration.
3. Copy the Redirect URI and save it for later use.

</TabItem>
<TabItem value="cli" label="Ory CLI">

The default redirect URI for LINE is `https://$PROJECT_SLUG.projects.oryapis.com/self-service/methods/oidc/callback/line`. Write it down for later use.

</TabItem>
</Tabs>
```

Next you will need to create a LINE application and configure it to work with Ory. Here's how you can do that:

1. Head over to the [LINE Business Account](https://account.line.biz/signup).
2. Create a new channel [in the Developer Console](https://developers.line.biz/console/)
3. Configure the required permissions: `PROFILE`, `OPENID_CONNECT`, `OC_EMAIL`.
4. On the LINE Login tab, configure the Callback URLs.
5. On the channel page, you will find the Channel ID and Channel Secret. Copy these values and save them for later use.

LINE is now set up! Continue with the following steps in Ory Console or Ory CLI to complete the configuration:

````mdx-code-block
<Tabs groupId="default">
<TabItem value="console" label="Ory Console" default>

1. Copy the Channel ID and Channel Secret from the LINE Developer Console and paste them into the corresponding fields in the Ory Console.
2. In the **Data Mapping** field of the form in the Ory Console, add the following Jsonnet code snippet,
which maps the desired claims to the Ory Identity schema:

```jsonnet
local claims = std.extVar('claims');

{
identity: {
traits: {
[if 'email' in claims then 'email' else null]: claims.email,
email: claims.email,
[if "name" in claims then "first_name" else null]: claims.name,
},
},
}
```

```mdx-code-block
<JsonnetWarning format="Jsonnet code snippets" use="data mapping" />
```

10. Click **Save Configuration**.

</TabItem>
<TabItem value="cli" label="Ory CLI">
1. Create a Jsonnet code snippet to map the desired claims to the Ory Identity schema.

```jsonnet
local claims = std.extVar('claims');
{
identity: {
traits: {
[if 'email' in claims then 'email' else null]: claims.email,
email: claims.email,
[if "name" in claims then "first_name" else null]: claims.name,
},
},
}
```

```mdx-code-block
<JsonnetWarning format="Jsonnet code snippets" use="data mapping" />
```

4. Encode the Jsonnet snippet with [Base64](https://www.base64encode.org/) or host it under an URL accessible to Ory Network.

```shell
cat your-data-mapping.jsonnet | base64
```

5. Download the Ory Identities config from your project and save it to a file:

```shell
## List all available workspaces
ory list workspaces

## List all available projects
ory list projects --workspace <workspace-id>

## Get config
ory get identity-config --project <project-id> --workspace <workspace-id> --format yaml > identity-config-$project-id.yaml
```

6. Add the social sign-in provider configuration to the downloaded config. Add the Jsonnet snippet with mappings as a Base64
string or provide an URL to the file.

```yaml
selfservice:
methods:
oidc:
config:
providers:
- id: line
provider: line
auth_url: https://access.line.me/oauth2/v2.1/authorize
issuer_url: https://access.line.me
token_url: https://api.line.me/oauth2/v2.1/token
scope:
- profile
- email
- openid
client_id: .... # Replace this with the Channel ID
client_secret: .... # Replace this with the Channel Secret
mapper_url: "base64://{YOUR_BASE64_ENCODED_JSONNET_HERE}"
# Alternatively, use an URL:
# mapper_url: https://storage.googleapis.com/abc-cde-prd/9cac9717f007808bf17f22ce7f4295c739604b183f05ac4afb4
enabled: true
```

7. Update the Ory Identities configuration using the file you worked with:

```shell
ory update identity-config --project <project-id> --workspace <workspace-id> --file identity-config.yaml
```

</TabItem>
</Tabs>
````

## Troubleshooting

```mdx-code-block
import SocialSigninTroubleshooting from '../_common/social-sign-in-troubleshooting.mdx'

<SocialSigninTroubleshooting />
```
Loading