flat-hospital-33004
07/04/2025, 7:10 AMmagnificent-energy-493
magnificent-energy-493
kratos.yml
, the UI will automatically display the "Sign in with Azure" button as part of the OIDC method group. The UI simply renders what Kratos provides in the flow data—no provider-specific code is required*12*.
1. Register your application in Azure and obtain the Client ID, Client Secret, and set the correct Redirect URI (matching the pattern required by Kratos).
2. Configure Azure as an OIDC provider in your kratos.yml
. This includes setting the client_id
, client_secret
, issuer_url
, and a Jsonnet data mapping for claims.
3. Set up the redirect URI in both Azure and Kratos to match the required pattern: http(s)://<domain-of-ory-kratos>:<public-port>/self-service/methods/oidc/callback/<provider-id>
4. Add the session hook to your Kratos config to avoid users needing to log in again after sign-up:
5. selfservice:
6. flows:
7. registration:
8. after:
9. oidc:
10. hooks:
11. - hook: session
12. Run the self-service UI. When the login flow is initialized, Kratos will include the OIDC method and the UI will render the Azure login button automatically*12*.
13. Test the flow: When a user clicks the Azure login button, the UI will POST to Kratos, which will handle the redirect to Azure and back.
For more details, see the OIDC provider configuration guide and the Azure-specific setup.flat-hospital-33004
07/15/2025, 7:45 PMclient_id
, client_secret
, issuer_url
, etc.
However, when I click the sign‑in button in the menu, I first get redirected to:
http://localhost:4433/self-service/login/browser?aal=&refresh=&return_to=&organization=&via=
…and then to:
http://localhost:3000/ui/login?flow=fc2f26ed-cec9-4ff2-9484-7161790cef6c
That second URL responds with a 404 error (screenshot attached).
For context:
I’m running a self‑hosted version of Ory Kratos locally with the VS Code debugger attached.
In the Azure app registration, I’ve set the redirect URI to:
http://localhost:4433/self-service/methods/oidc/callback/azure
Would you mind taking a quick look at my kratos.yml (pasted below) to see if you spot anything that might cause the 404 and prevent the Azure login flow from working?
version: v0.13.0
dsn: memory
serve:
public:
base_url: <http://localhost:4433/>
cors:
enabled: true
admin:
base_url: <http://localhost:4434/>
selfservice:
default_browser_return_url: <http://localhost:3000/ui/welcome>
methods:
oidc:
enabled: true
config:
base_redirect_uri: <http://localhost:3000/>
providers:
- id: azure
provider: microsoft
client_id: [REDACTED]
client_secret: [REDACTED]
# issuer_url: <https://login.microsoftonline.com/common>
microsoft_tenant: common
mapper_url: "<base64://bG9jYWwgY2xhaW1zID0gc3RkLmV4dFZhcignY2xhaW1zJyk7Cgp7CiAgaWRlbnR>pdHk6IHsKICAgIHRyYWl0czogewogICAgICBbaWYgJ2VtYWlsJyBpbiBjbGFpbXMgJiYgJ3VwbicgaW4gY2xhaW1zLnJhd19jbGFpbXMgJiYgY2xhaW1zLmVtYWlsID09IGNsYWltcy5yYXdfY2xhaW1zLnVwbiB0aGVuICdlbWFpbCcgZWxzZSBudWxsXTogY2xhaW1zLmVtYWlsLAogICAgfSwKICAgIHZlcmlmaWVkX2FkZHJlc3Nlczogc3RkLnBydW5lKFsKICAgICAgaWYgJ2VtYWlsJyBpbiBjbGFpbXMgJiYgJ3VwbicgaW4gY2xhaW1zLnJhd19jbGFpbXMgJiYgY2xhaW1zLmVtYWlsID09IGNsYWltcy5yYXdfY2xhaW1zLnVwbiB0aGVuIHsgdmlhOiAnZW1haWwnLCB2YWx1ZTogY2xhaW1zLmVtYWlsIH0sCiAgICBdKSwKICB9LAp9"
scope:
- email
- openid
- profile
flows:
error:
ui_url: <http://localhost:3000/ui/error>
settings:
ui_url: <http://localhost:3000/ui/settings>
privileged_session_max_age: 15m
recovery:
enabled: true
ui_url: <http://localhost:3000/ui/recovery>
verification:
enabled: true
ui_url: <http://localhost:3000/ui/verification>
after:
default_browser_return_url: <http://localhost:3000/ui/welcome>
logout:
after:
default_browser_return_url: <http://localhost:3000/ui/login>
login:
ui_url: <http://localhost:3000/ui/login>
registration:
ui_url: <http://localhost:3000/ui/registration>
after:
password:
hooks:
- hook: session
log:
level: debug
format: text
leak_sensitive_values: true
secrets:
cookie:
- PLEASE-CHANGE-ME-I-AM-VERY-INSECURE
hashers:
algorithm: bcrypt
bcrypt:
cost: 8
identity:
default_schema_id: <preset://email>
schemas:
- id: <preset://email>
url: file:///etc/config/kratos/identity.schema.json
courier:
smtp:
connection_uri: <smtps://test:test@mailslurper:1025/?skip_ssl_verify=trSue>
Thanks again for your help!magnificent-energy-493
/ui/login
, so there is something wrong with your self-service UI.
• oidc provider config looks correct
• You have set base_redirect_uri: <http://localhost:3000/>
in your OIDC config. This is not required for most self-hosted setups
I would suggest you follow the quickstart here first: https://www.ory.sh/docs/kratos/quickstart
for more advanced you can try this out: https://github.com/ory/kratos/tree/master/contrib/quickstart/kratos/oidcflat-hospital-33004
07/16/2025, 10:14 AMflow
config I was redirecting users to /ui/
which does not exist in the self-service UI. In the end, I've removed the /ui/
segment from the config and it worked fine!