|
| 1 | +--- |
| 2 | +id: line |
| 3 | +title: Add LINE as a social sign-in provider in Ory |
| 4 | +sidebar_label: LINE |
| 5 | +--- |
| 6 | + |
| 7 | +# LINE |
| 8 | + |
| 9 | +```mdx-code-block |
| 10 | +import JsonnetWarning from "../../_common/jsonnetwarning.mdx" |
| 11 | +import Tabs from '@theme/Tabs'; |
| 12 | +import TabItem from '@theme/TabItem'; |
| 13 | +
|
| 14 | +<Tabs groupId="default"> |
| 15 | +<TabItem value="console" label="Ory Console" default> |
| 16 | +
|
| 17 | +Follow these steps to add LINE as a social sign-in provider to your project using the Ory Console: |
| 18 | +
|
| 19 | +1. Go to <ConsoleLink route="project.socialSignIn" />. |
| 20 | +2. Click the switch next to the LINE logo to start the configuration. |
| 21 | +3. Copy the Redirect URI and save it for later use. |
| 22 | +
|
| 23 | +</TabItem> |
| 24 | +<TabItem value="cli" label="Ory CLI"> |
| 25 | +
|
| 26 | +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. |
| 27 | +
|
| 28 | +</TabItem> |
| 29 | +</Tabs> |
| 30 | +``` |
| 31 | + |
| 32 | +Next you will need to create a LINE application and configure it to work with Ory. Here's how you can do that: |
| 33 | + |
| 34 | +1. Head over to the [LINE Business Account](https://account.line.biz/signup). |
| 35 | +2. Create a new channel [in the Developer Console](https://developers.line.biz/console/) |
| 36 | +3. Configure the required permissions: `PROFILE`, `OPENID_CONNECT`, `OC_EMAIL`. |
| 37 | +4. On the LINE Login tab, configure the Callback URLs. |
| 38 | +5. On the channel page, you will find the Channel ID and Channel Secret. Copy these values and save them for later use. |
| 39 | + |
| 40 | +LINE is now set up! Continue with the following steps in Ory Console or Ory CLI to complete the configuration: |
| 41 | + |
| 42 | +````mdx-code-block |
| 43 | +<Tabs groupId="default"> |
| 44 | +<TabItem value="console" label="Ory Console" default> |
| 45 | +
|
| 46 | +1. Copy the Channel ID and Channel Secret from the LINE Developer Console and paste them into the corresponding fields in the Ory Console. |
| 47 | +2. In the **Data Mapping** field of the form in the Ory Console, add the following Jsonnet code snippet, |
| 48 | + which maps the desired claims to the Ory Identity schema: |
| 49 | +
|
| 50 | + ```jsonnet |
| 51 | + local claims = std.extVar('claims'); |
| 52 | +
|
| 53 | + { |
| 54 | + identity: { |
| 55 | + traits: { |
| 56 | + [if 'email' in claims then 'email' else null]: claims.email, |
| 57 | + email: claims.email, |
| 58 | + [if "name" in claims then "first_name" else null]: claims.name, |
| 59 | + }, |
| 60 | + }, |
| 61 | + } |
| 62 | + ``` |
| 63 | +
|
| 64 | +```mdx-code-block |
| 65 | + <JsonnetWarning format="Jsonnet code snippets" use="data mapping" /> |
| 66 | +``` |
| 67 | +
|
| 68 | +10. Click **Save Configuration**. |
| 69 | +
|
| 70 | +</TabItem> |
| 71 | +<TabItem value="cli" label="Ory CLI"> |
| 72 | +1. Create a Jsonnet code snippet to map the desired claims to the Ory Identity schema. |
| 73 | +
|
| 74 | + ```jsonnet |
| 75 | + local claims = std.extVar('claims'); |
| 76 | + { |
| 77 | + identity: { |
| 78 | + traits: { |
| 79 | + [if 'email' in claims then 'email' else null]: claims.email, |
| 80 | + email: claims.email, |
| 81 | + [if "name" in claims then "first_name" else null]: claims.name, |
| 82 | + }, |
| 83 | + }, |
| 84 | + } |
| 85 | + ``` |
| 86 | +
|
| 87 | +```mdx-code-block |
| 88 | + <JsonnetWarning format="Jsonnet code snippets" use="data mapping" /> |
| 89 | +``` |
| 90 | +
|
| 91 | +4. Encode the Jsonnet snippet with [Base64](https://www.base64encode.org/) or host it under an URL accessible to Ory Network. |
| 92 | +
|
| 93 | + ```shell |
| 94 | + cat your-data-mapping.jsonnet | base64 |
| 95 | + ``` |
| 96 | +
|
| 97 | +5. Download the Ory Identities config from your project and save it to a file: |
| 98 | +
|
| 99 | + ```shell |
| 100 | + ## List all available workspaces |
| 101 | + ory list workspaces |
| 102 | +
|
| 103 | + ## List all available projects |
| 104 | + ory list projects --workspace <workspace-id> |
| 105 | +
|
| 106 | + ## Get config |
| 107 | + ory get identity-config --project <project-id> --workspace <workspace-id> --format yaml > identity-config-$project-id.yaml |
| 108 | + ``` |
| 109 | +
|
| 110 | +6. Add the social sign-in provider configuration to the downloaded config. Add the Jsonnet snippet with mappings as a Base64 |
| 111 | + string or provide an URL to the file. |
| 112 | +
|
| 113 | + ```yaml |
| 114 | + selfservice: |
| 115 | + methods: |
| 116 | + oidc: |
| 117 | + config: |
| 118 | + providers: |
| 119 | + - id: line |
| 120 | + provider: line |
| 121 | + auth_url: https://access.line.me/oauth2/v2.1/authorize |
| 122 | + issuer_url: https://access.line.me |
| 123 | + token_url: https://api.line.me/oauth2/v2.1/token |
| 124 | + scope: |
| 125 | + - profile |
| 126 | + - email |
| 127 | + - openid |
| 128 | + client_id: .... # Replace this with the Channel ID |
| 129 | + client_secret: .... # Replace this with the Channel Secret |
| 130 | + mapper_url: "base64://{YOUR_BASE64_ENCODED_JSONNET_HERE}" |
| 131 | + # Alternatively, use an URL: |
| 132 | + # mapper_url: https://storage.googleapis.com/abc-cde-prd/9cac9717f007808bf17f22ce7f4295c739604b183f05ac4afb4 |
| 133 | + enabled: true |
| 134 | + ``` |
| 135 | +
|
| 136 | +7. Update the Ory Identities configuration using the file you worked with: |
| 137 | +
|
| 138 | + ```shell |
| 139 | + ory update identity-config --project <project-id> --workspace <workspace-id> --file identity-config.yaml |
| 140 | + ``` |
| 141 | +
|
| 142 | +</TabItem> |
| 143 | +</Tabs> |
| 144 | +```` |
| 145 | + |
| 146 | +## Troubleshooting |
| 147 | + |
| 148 | +```mdx-code-block |
| 149 | +import SocialSigninTroubleshooting from '../_common/social-sign-in-troubleshooting.mdx' |
| 150 | +
|
| 151 | +<SocialSigninTroubleshooting /> |
| 152 | +``` |
0 commit comments