Skip to content

Commit

Permalink
feat: document LINE social sign-in provider
Browse files Browse the repository at this point in the history
Relates to ory/kratos#4240
  • Loading branch information
David-Wobrock committed Jan 14, 2025
1 parent 444987d commit 08eea37
Showing 1 changed file with 154 additions and 0 deletions.
154 changes: 154 additions & 0 deletions docs/kratos/social-signin/98_line.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
id: line
title: Add LINE as a social sign-in provider in Ory
sidebar_label: LINE
---

# Twitter

```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 twitter 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
scope:
- email
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 />
```

0 comments on commit 08eea37

Please sign in to comment.