solid-contrib/solid-crud-tests

obtain-auth-headers helper not working yet

Closed this issue · 10 comments

I'm pretty much developing this in the master branch for the moment -
Just tried:

NODE_TLS_REJECT_UNAUTHORIZED=0 ts-node-dev test/helpers/obtain-auth-headers.ts

And seeing "invalid json response body at https://localhost:8443/token reason: Unexpected token I in JSON at position 0"
That 'I' is the first character of "Internal Server Error" - it's running into nodeSolidServer/node-solid-server#1445. Investigating.

Now trying with:

+    grant_type: "authorization_code",
+    code_verifier: "codeVerifier" as string,
+    code: "url.query.code" as string,
+    redirect_uri: "redirectUri" as string

If I set:

authorizationCode = {
          exp: 1594816163,
          redirect_uri: 'https://app.com/callback',
          aud: client.client_id,
          sub: 'bla'
        };

on line 546 of src/handlers/TokenRequest.js in @solid/oidc-op then https://github.com/solid/storage-tests/blob/master/test/helpers/obtain-auth-headers.ts#L89 returns something that looks reasonable.

I'll try testing it against https://github.com/michielbdejong/solid-app-kit.

With solid-app-kit I get an error at the registration step already:
solid-contrib/solid-auth-fetcher#2
Should also check why tests from https://github.com/pdsinterop/test-suites are failing for solid-app-kit and see if that's related.

my next thought it, solid-auth-fetcher has all this integrated popup code, i should be able to reverse-engineer that, and in the process, confirm that all of that is working

That was a useful thought, now we have this to work with: solid-contrib/solid-auth-fetcher#11

import { login } from "solid-auth-fetcher";


login({
  oidcIssuer: "https://localhost:8443",
  redirect: "https://mysite.com/redirect"
}).then((session) => {
  console.log("Please visit", (session.neededAction as any).redirectUrl);
})

Should combine this with https://github.com/solid/webid-provider-tests/blob/master/test/surface/token.test.ts#L29 and then that whole flow should be doable from node.