incalculable-air-40968
06/26/2025, 11:34 AMbrief-egg-61061
06/26/2025, 11:36 AMbrief-egg-61061
06/26/2025, 11:36 AMory create oauth2-client --project "$PROJECT_ID" \ --name "Example Corp" \ --grant-type authorization_code,refresh_token \ --response-type code \ --scope openid,offline_access,email \ --redirect-uri <https://your-project-slug.projects.oryapis.com/self-service/methods/oidc/callback/H1o_k--i>
- The SSO provider project manages user identities and provides OAuth2/OIDC endpoints for authentication and authorization. Apps can now use this provider for sign-in via the OAuth2 authorization code flow [Setting up the SSO provider](https://www.ory.sh/docs/kratos/social-signin/ory). 2. Configure Ory Kratos to Use the OAuth2 Provider: - In the Ory Console, go to Authentication → Social Sign-In. - Click Add new OpenID Connect provider. - Enter the Client ID, Client Secret, and Issuer URL from the OAuth2 client you created above. - Copy the Redirect URI provided by the Console and add it to your OAuth2 client configuration in the SSO provider project. - Save the configuration [Connecting a project to the SSO provider](https://www.ory.sh/docs/kratos/social-signin/ory#connecting-a-project-to-the-sso-provider). 3. (Optional) Adjust Scopes and Data Mapping: - You can define which OAuth scopes Ory requests from the provider (e.g., openid
, offline_access
, email
). - You can also set up custom data mappings for user traits [Scopes and Data Mapping](https://www.ory.sh/docs/kratos/social-signin/ory#scopes). Summary: - Ory Hydra (OAuth2/OIDC) is set up as a project in Ory Network. - Ory Kratos is configured to use this project as an OIDC provider for social sign-in. - All configuration can be managed via the Ory Console or Ory CLI. If you need to customize login and consent UIs, you can also configure custom URLs in your OAuth2 project settings [Configure Ory Network](https://www.ory.sh/docs/hydra/guides/custom-ui-oauth2#configure-ory-network). If you need more detailed, step-by-step instructions, please specify which part of the setup you need help with.incalculable-air-40968
06/26/2025, 11:39 AMlogin_challenge
query parameter to serve as an OpenID Connect Provider._
#
oauth2_provider:
override_return_to: true
url: https://hydra
but now i cant do thatbrief-egg-61061
06/26/2025, 11:39 AMbrief-egg-61061
06/26/2025, 11:39 AMoauth2_provider
section in the Kratos config as you would in a self-hosted setup. The Ory Network platform manages the integration between Ory Identities (Kratos) and Ory OAuth2 & OpenID Connect (Hydra) for you. This means: - The connection between Kratos and Hydra is handled internally by Ory Network. - You do not need (and cannot) set the oauth2_provider.url
or override_return_to
in your Kratos config. - Instead, you configure OAuth2/OIDC flows, social sign-in, and identity provider integrations through the [Ory Console](https://console.ory.sh/) or the Ory CLI. For advanced use cases, such as overriding the return URL after identity flows, Ory Network provides a setting called Always Return to OAuth2 provider. This can be enabled in the Ory Console under OAuth 2 → Identity integration settings. When enabled, it ensures users are always redirected back to the OAuth2 flow after completing identity-related actions, similar to what override_return_to: true
did in self-hosted setups. You can also enable this via the CLI: bash ory patch project <your-project-id> \ --replace '/services/identity/oauth2_provider/override_return_to=true'
[Identity Provider Integration Settings](https://www.ory.sh/docs/oauth2-oidc/identity-provider-integration-settings#overview) Summary: - In Ory Network, you do not set oauth2_provider
in the Kratos config. - Use the Ory Console or CLI to manage OAuth2/OIDC integration and advanced settings. If you need to connect Kratos to an external OIDC provider, use the Social Sign-In section in the Console, not the config file directly [Connecting a project to the SSO provider](https://www.ory.sh/docs/kratos/social-signin/ory#connecting-a-project-to-the-sso-provider). If you have a specific use case that is not covered by these settings, please provide more details.brief-egg-61061
06/26/2025, 11:45 AMbrief-egg-61061
06/26/2025, 11:45 AMoauth2_provider
section directly in the Kratos config as you did in self-hosted setups. The integration between Ory Identities (Kratos) and Ory OAuth2 & OpenID Connect (Hydra) is managed by the Ory Network platform itself. Instead of setting oauth2_provider.url
and override_return_to
in your config file, you should use the Ory Console or CLI to manage these integrations and advanced settings. For example, to achieve the same effect as override_return_to: true
, you can enable the Always Return to OAuth2 provider setting in the Ory Console under OAuth 2 → Identity integration settings. This ensures users are redirected back to the OAuth2 flow after completing identity-related actions. You can also enable this via the CLI: bash ory patch project <your-project-id> \ --replace '/services/identity/oauth2_provider/override_return_to=true'
This approach replaces the need for the oauth2_provider
block in your Kratos config when using Ory Network. If you need to connect to an external OIDC provider, use the Social Sign-In section in the Console instead of editing the config file directly [Identity Provider Integration Settings](https://www.ory.sh/docs/oauth2-oidc/identity-provider-integration-settings#overview) [Connecting a project to the SSO provider](https://www.ory.sh/docs/kratos/social-signin/ory#connecting-a-project-to-the-sso-provider). If you have a specific scenario that is not covered by these settings, please provide more details.incalculable-air-40968
06/26/2025, 11:51 AMbrief-egg-61061
06/26/2025, 11:51 AMbrief-egg-61061
06/26/2025, 11:51 AMincalculable-air-40968
06/26/2025, 12:03 PMbrief-egg-61061
06/26/2025, 12:03 PMbrief-egg-61061
06/26/2025, 12:03 PMincalculable-air-40968
06/26/2025, 12:13 PMbrief-egg-61061
06/26/2025, 12:13 PMbrief-egg-61061
06/26/2025, 12:14 PMclient_id
and client_secret
from your Google OAuth app - The appropriate scopes (e.g., email
, profile
) - A data mapping (Jsonnet) snippet to map Google claims to your identity traits Example YAML snippet for the identity config: yaml selfservice: methods: oidc: config: providers: - id: google provider: google client_id: <YOUR_GOOGLE_CLIENT_ID> client_secret: <YOUR_GOOGLE_CLIENT_SECRET> mapper_url: "base64://<YOUR_BASE64_ENCODED_JSONNET>" scope: - email - profile requested_claims: id_token: email: essential: true email_verified: essential: true given_name: essential: true family_name: null enabled: true
[Google Social Sign-In Data Mapping](https://www.ory.sh/docs/kratos/social-signin/google#data-mapping) Example Jsonnet for data mapping: jsonnet local claims = { email_verified: false, } + std.extVar('claims'); { identity: { traits: { [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email, first_name: claims.given_name, last_name: claims.family_name, // Add custom traits here, e.g.: // group: claims.hd, // For Google Workspace domain }, }, }
[Google Data Mapping Example](https://www.ory.sh/docs/kratos/social-signin/google#additional-configuration) --- ### 2. Issue JWT Tokens with Custom Traits Ory Network allows you to convert sessions to JWTs, and you can use a claims mapper (Jsonnet) to include custom traits in the JWT. The specific configuration for JWT claims mapping is not detailed in the provided sources, but the general approach is to use a Jsonnet template to map identity traits to JWT claims. Note: The knowledge sources do not provide a full example of the JWT claims mapping configuration for Ory Network. They do show how to map identity traits from Google, which would then be available for inclusion in JWTs. --- ### 3. OAuth2 (Hydra) Integration In Ory Network, the OAuth2 (Hydra) service is managed for you. You do not need to manually configure the oauth2_provider
block as in self-hosted setups. Instead, after social sign-in, the user session can be exchanged for a JWT via the OAuth2 flow, and the custom traits you mapped will be available in the identity/session. --- Summary: - Configure Google as a social sign-in provider with the required scopes and a Jsonnet data mapping for custom traits. - The mapped traits will be available in the user's identity and can be included in JWTs issued by Ory Network. - You do not need to manually configure Hydra integration; Ory Network handles this internally. If you need to include additional custom claims in the JWT, you would use a claims mapper, but the exact configuration for this in Ory Network is not detailed in the provided sources. If you need more details on JWT claims mapping, please specify, and I can help further if more information is available. [Google Social Sign-In Setup](https://www.ory.sh/docs/kratos/social-signin/google#data-mapping) [Connecting a project to the SSO provider](https://www.ory.sh/docs/kratos/social-signin/ory#connecting-a-project-to-the-sso-provider)incalculable-air-40968
06/26/2025, 12:17 PMbrief-egg-61061
06/26/2025, 12:18 PMbrief-egg-61061
06/26/2025, 12:18 PMopenid
, email
, profile
) [Authorization Code Grant](https://www.ory.sh/docs/getting-started/ory-network-oauth2#authorization-code-grant). ### 3. Ory Network Presents Login UI - Ory Network displays the login page, which includes a “Sign in with Google” button (assuming you have configured Google as a social sign-in provider in your Ory project) [Social sign-in](https://www.ory.sh/docs/identities/get-started/social-sign-in). ### 4. User Authenticates with Google - The user clicks the Google button and is redirected to Google’s authentication page. - The user logs in and consents to share their profile information. ### 5. Google Redirects Back to Ory Network - After successful authentication, Google redirects the user back to Ory Network with an authorization code. ### 6. Ory Network Maps Google Data to Identity - Ory Network uses your configured data mapping (Jsonnet) to map Google claims (like email, name, etc.) to the user’s identity traits in Ory [Google Data Mapping](https://www.ory.sh/docs/kratos/social-signin/google#data-mapping). ### 7. Ory Network Issues OAuth2 Tokens - Ory Network completes the OAuth2 flow, issuing an id_token
and access_token
(and optionally a refresh_token
) to your app’s redirect URI [Authorization Code Grant](https://www.ory.sh/docs/getting-started/ory-network-oauth2#authorization-code-grant). ### 8. App Receives Tokens - Your app receives the tokens and can use the id_token
to identify the user and the access_token
to access APIs on behalf of the user. --- Summary: - The user authenticates via Google through Ory Network’s login UI. - Ory Network handles the OAuth2 flow and token issuance. - Your app never directly handles Google credentials; it only receives tokens from Ory Network. This flow leverages Ory Network’s managed integration between identity, social sign-in, and OAuth2, so you do not need to manually orchestrate between Kratos and Hydra as in self-hosted setups [Social sign-in](https://www.ory.sh/docs/identities/get-started/social-sign-in).