acoustic-father-92306
05/09/2023, 7:48 AMcreateBrowserLoginFlow
, filling the data and using the provided action
url) I get a CORS error response.
Here is my kratos.yml:
version: v0.13.0
dsn: memory
serve:
public:
base_url: <http://127.0.0.1:4433/>
cors:
enabled: true
allowed_origins:
- <http://127.0.0.1:3000> # ui
- <http://127.0.0.1:4433>
allowed_methods:
- POST
- GET
- PUT
- PATCH
- DELETE
- OPTIONS
allowed_headers:
- Authorization
- Content-Type
- X-Session-Token
- Cookie
- Access-Control-Allow-Origin
exposed_headers:
- Content-Type
- Set-Cookie
allow_credentials: true
admin:
base_url: <http://kratos:4434/>
selfservice:
default_browser_return_url: <http://127.0.0.1:3000>
allowed_return_urls:
- <http://127.0.0.1:3000>
methods:
password:
enabled: true
totp:
config:
issuer: Kratos
enabled: true
lookup_secret:
enabled: true
link:
enabled: true
code:
enabled: true
flows:
error:
ui_url: <http://127.0.0.1:3000/auth>
settings:
ui_url: <http://127.0.0.1:3000/auth>
privileged_session_max_age: 15m
required_aal: highest_available
recovery:
enabled: true
ui_url: <http://127.0.0.1:3000/auth>
use: code
verification:
enabled: true
ui_url: <http://127.0.0.1:3000/auth>
use: code
after:
default_browser_return_url: <http://127.0.0.1:3000/auth>
logout:
after:
default_browser_return_url: <http://127.0.0.1:3000/auth>
login:
ui_url: <http://127.0.0.1:3000/auth>
lifespan: 10m
registration:
lifespan: 10m
ui_url: <http://127.0.0.1:3000/auth>
after:
password:
hooks:
- hook: session
- hook: show_verification_ui
log:
level: debug
format: text
leak_sensitive_values: true
secrets:
cookie:
- PLEASE-CHANGE-ME-I-AM-VERY-INSECURE
cipher:
- 32-LONG-SECRET-NOT-SECURE-AT-ALL
ciphers:
algorithm: xchacha20-poly1305
hashers:
algorithm: bcrypt
bcrypt:
cost: 8
identity:
default_schema_id: default
schemas:
- id: default
url: file:///etc/config/kratos/identity.schema.json
courier:
smtp:
connection_uri: <smtps://test:test@mailslurper:1025/?skip_ssl_verify=true>
Can you help me?bland-eye-99092
05/09/2023, 7:52 AMbland-eye-99092
05/09/2023, 7:53 AMacoustic-father-92306
05/09/2023, 9:52 AMdocker compose -f quickstart.yml -f quickstart-standalone.yml up --build --force-recreate
of your github repository
And the React app is vite application runing on http://127.0.0.1:3000acoustic-father-92306
05/09/2023, 11:34 AMory proxy
and ory tunnel
without success.
Without proxy or tunel at-least the GET <http://127.0.0.1:3344//self-service/login/browser?refresh=true>
returns result.bland-eye-99092
05/09/2023, 11:35 AMacoustic-father-92306
05/09/2023, 11:38 AMconst basePath = "<http://localhost:4000>";
const baseOptions = {
timeout: undefined,
withCredentials: true,
};
const api = new KratosClient.FrontendApi(new KratosClient.Configuration({
baseOptions,
basePath,
}));
acoustic-father-92306
05/09/2023, 11:38 AMacoustic-father-92306
05/09/2023, 11:39 AMbland-eye-99092
05/09/2023, 11:39 AMacoustic-father-92306
05/09/2023, 11:39 AMbland-eye-99092
05/09/2023, 11:40 AMacoustic-father-92306
05/09/2023, 11:40 AMacoustic-father-92306
05/09/2023, 11:40 AMacoustic-father-92306
05/09/2023, 11:44 AMAccess to fetch at '<http://127.0.0.1:4433/self-service/login?flow=34fbf4b1-1291-4cc0-813e-5cb7ac684a27>' from origin '<http://127.0.0.1:3000>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
acoustic-father-92306
05/09/2023, 11:51 AM{
csrf_token: "ifW3msCSrHdTHiZ4gXoiP2JPZBwvNx+FuA38Kh5sifLKxKGX+7PFNSbxbBTgqG9CeSuxOQpCjXSxJLPBHTrQZA==",
identifier: "<mailto:test@mail.com|test@mail.com>",
method: "password",
password: "p-O)i9U*y7",
}
The request headers are:
Accept:
application/json
Content-Type:
application/json
Csrf_token:
ifW3msCSrHdTHiZ4gXoiP2JPZBwvNx+FuA38Kh5sifLKxKGX+7PFNSbxbBTgqG9CeSuxOQpCjXSxJLPBHTrQZA==
Referer:
<http://127.0.0.1:3000/>
Sec-Ch-Ua:
"Google Chrome";v="113", "Chromium";v="113", "Not-A.Brand";v="24"
Sec-Ch-Ua-Mobile:
?0
Sec-Ch-Ua-Platform:
"Linux"
User-Agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
acoustic-father-92306
05/09/2023, 11:52 AMbland-eye-99092
05/09/2023, 12:06 PMacoustic-father-92306
05/09/2023, 12:07 PM<http://127.0.0.1:3000/>
acoustic-father-92306
05/09/2023, 12:09 PMmode
to no-cors
?
If I set it the result is:
POST <http://127.0.0.1:4433/self-service/login?flow=aafaebe8-7162-4757-9995-7b5978671612> net::ERR_ABORTED 400 (Bad Request)
bland-eye-99092
05/09/2023, 12:09 PMbland-eye-99092
05/09/2023, 12:10 PMcurl -X OPTIONS -vvv -H 'Origin: <http://127.0.0.1:3000>' -H "Access-Control-Request-Method: GET" <http://127.0.0.1:4433/self-service/login/browser>
acoustic-father-92306
05/09/2023, 12:10 PM» curl -X OPTIONS -vvv -H 'Origin: <http://127.0.0.1:3000>' -H "Access-Control-Request-Method: GET" <http://127.0.0.1:4433/self-service/login/browser>
* Trying 127.0.0.1:4433...
* Connected to 127.0.0.1 (127.0.0.1) port 4433 (#0)
> OPTIONS /self-service/login/browser HTTP/1.1
> Host: 127.0.0.1:4433
> User-Agent: curl/7.81.0
> Accept: */*
> Origin: <http://127.0.0.1:3000>
> Access-Control-Request-Method: GET
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 204 No Content
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: GET
< Access-Control-Allow-Origin: <http://127.0.0.1:3000>
< Vary: Origin
< Vary: Access-Control-Request-Method
< Vary: Access-Control-Request-Headers
< Date: Tue, 09 May 2023 12:10:32 GMT
<
* Connection #0 to host 127.0.0.1 left intact
bland-eye-99092
05/09/2023, 12:13 PM< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: GET
< Access-Control-Allow-Origin: <http://127.0.0.1:3000>
for me. Could you try restarting kratos?bland-eye-99092
05/09/2023, 12:13 PMacoustic-father-92306
05/09/2023, 12:14 PMdocker compose -f quickstart.yml -f quickstart-standalone.yml up --build --force-recreate
?bland-eye-99092
05/09/2023, 12:14 PMacoustic-father-92306
05/09/2023, 12:15 PMAccess to fetch at '<http://127.0.0.1:4433/self-service/login?flow=4535ac0e-f18d-42f6-96cb-47aa123f9508>' from origin '<http://127.0.0.1:3000>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
acoustic-father-92306
05/09/2023, 12:17 PM<https://github.com/ory/kratos.git>
are you using?
I'm on v0.13.0
.bland-eye-99092
05/09/2023, 12:18 PMacoustic-father-92306
05/09/2023, 12:18 PMacoustic-father-92306
05/09/2023, 12:19 PMbland-eye-99092
05/09/2023, 12:26 PMacoustic-father-92306
05/09/2023, 12:27 PMacoustic-father-92306
05/09/2023, 12:27 PMacoustic-father-92306
05/09/2023, 12:28 PMCross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at <http://127.0.0.1:4433/self-service/login?flow=4d22cd06-9384-4561-adf8-78ef3bdefbce>. (Reason: CORS request did not succeed). Status code: (null)
acoustic-father-92306
05/09/2023, 1:05 PMacoustic-father-92306
05/09/2023, 1:06 PMacoustic-father-92306
05/09/2023, 1:07 PMacoustic-father-92306
05/09/2023, 1:10 PMcreateNativeLoginFlow
is it possible to get it working in the browser?bland-eye-99092
05/09/2023, 1:15 PM"*"
to the allowed origins. And if that doesn’t work, the issue is probably not with kratos. Also, try calling the endpoint using fetch
instead of the SDK.bland-eye-99092
05/09/2023, 1:16 PMacoustic-father-92306
05/09/2023, 1:16 PMacoustic-father-92306
05/09/2023, 1:16 PMbland-eye-99092
05/09/2023, 1:17 PMacoustic-father-92306
05/09/2023, 1:17 PMYou could try addingYou mean in the browser request?to the allowed origins."*"
bland-eye-99092
05/09/2023, 1:18 PMacoustic-father-92306
05/09/2023, 1:19 PMupdateLoginFlow
fresh-carpet-18970
05/11/2023, 8:24 AMfresh-carpet-18970
05/11/2023, 8:28 AMacoustic-father-92306
05/11/2023, 8:48 AM