DEFINE TOKEN token_name
-- Use this token provider for database authorization
ON DATABASE
-- Specify the JWKS specification used to verify the token
TYPE JWKS
-- Specify the URL where the JWKS object can be found
VALUE "https://example.com/.well-known/jwks.json"
;
This returns an error similar to this:
surrealdb-migrations apply
Error:
0: Parse error: Failed to parse query at line 8 column 8 expected query to end
0: |
0: 8 | DEFINE TOKEN ory ON SCOPE user TYPE JWKS VALUE "http://oathkeeper:4456/.well-...
0: | ^ perhaps missing a semicolon on the previous statement?
0:
1: Parse error: Failed to parse query at line 8 column 8 expected query to end
1: |
1: 8 | DEFINE TOKEN ory ON SCOPE user TYPE JWKS VALUE "http://oathkeeper:4456/.well-...
1: | ^ perhaps missing a semicolon on the previous statement?
1:
Location:
/root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/surrealdb-migrations-1.4.0/src/surrealdb.rs:157
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 3 frames hidden ⋮
4: surrealdb_migrations::surrealdb::apply_in_transaction::{{closure}}::h6d1e25f40dcf785d
at <unknown source file>:<unknown line>
5: surrealdb_migrations::apply::main::{{closure}}::h146ba33a0e095570
at <unknown source file>:<unknown line>
6: surrealdb_migrations::sub_main::{{closure}}::heb13da4601b5befe
at <unknown source file>:<unknown line>
7: tokio::runtime::park::CachedParkThread::block_on::h2d0b779a8f0f5b12
at <unknown source file>:<unknown line>
8: surrealdb_migrations::main::h1ba1c626e949b292
at <unknown source file>:<unknown line>
9: std::sys_common::backtrace::__rust_begin_short_backtrace::h3760d9aa58d3944c
at <unknown source file>:<unknown line>
10: std::rt::lang_start::{{closure}}::hdf356da95c0fe837
at <unknown source file>:<unknown line>
11: std::rt::lang_start_internal::h0ddfe42b2029814a
at <unknown source file>:<unknown line>
12: main<unknown>
at <unknown source file>:<unknown line>
13: __libc_start_main<unknown>
at <unknown source file>:<unknown line>
14: _start<unknown>
at <unknown source file>:<unknown line>
Expected behavior
The migration should be applied.
Information
Please complete the following information and remove the unnecessary ones.
Describe the bug It's not possible to apply a migration that creates a JWKS token with surrealdb migrations.
To Reproduce Create a migration with the following example from the documentation:
https://surrealdb.com/docs/surrealdb/surrealql/statements/define/token#json-web-key-set-jwks-since-120
This returns an error similar to this:
Expected behavior The migration should be applied.
Information Please complete the following information and remove the unnecessary ones.
Additional context Same issue existed in Surrealist: https://github.com/surrealdb/surrealist/issues/244
Was fixed with enabling the jwks feature for Surreraldb: https://github.com/surrealdb/surrealql.wasm/commit/15c6ead3f09f8c2879f0c4bc4b3229ef9b76f96e