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);
})
When you visit that redirectUrl, log in, and authorize the app, you end up at something like https://mysite.com/redirect?code=4a1255998b2090f65f9275a7d9aa224c&id_token=eyJhbGciOiJSUzI1NiIsImtpZCI6IlhzMnhtbWkxdzJzIn0.eyJpc3MiOiJodHRwczovL2xvY2FsaG9zdDo4NDQzIiwiYXVkIjoiNjM2ZTNmZWM0NzQxNmNhMzFkNThkMTUzNDRlYmRmZGEiLCJhenAiOiI2MzZlM2ZlYzQ3NDE2Y2EzMWQ1OGQxNTM0NGViZGZkYSIsInN1YiI6Imh0dHBzOi8vbG9jYWxob3N0Ojg0NDMvcHJvZmlsZS9jYXJkI21lIiwiZXhwIjoxNTk2MTA3NTMzLCJpYXQiOjE1OTQ4OTc5MzMsImp0aSI6IjkyYTVkOWQ3OWQzMzI2ZGIiLCJub25jZSI6IiIsImNfaGFzaCI6IlhIeHZKdFhpZWc5WTJTcmZtd1drSUEifQ.n6Lh5ZaNEChqz3oSjotqIzKivDjASuubV4_mvJIivb3Oz3e8p2meL_6fUJSpDz-S4IzC2pIyIwZ_gyxoNBK2lq9-ASjouNmYN77UnfEaQoevXThEzE1duCUOzuABUfDobUlub4wZ3jO9oNMWY8xEx3p2UZ62hLcMftvo01CIo68zQr65swKwhrvgyOaSfdVswxJRC_xN1F3MDaBWYznFXAf2mjXHiXrn2fWa5AB-epriVRdkqQh7LEOQlcGiYeujszeoy3Xy3m6ixPheHuS1KxBprpjjFKvFQxnQL1Upk1MKVInnSvSZZVlLK5hPZbhMzUT7wBYwC84tBd05IZcmcg&state=global.
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.
Fixed