Add play uri for login and register in hydra (#1421)
Signed-off-by: Gregoire Parant <g.parant@thecodingmachine.com>
This commit is contained in:
parent
f60678478b
commit
6cf86ec8dc
4 changed files with 15 additions and 8 deletions
|
@ -27,13 +27,17 @@ export class AuthenticateController extends BaseController {
|
|||
console.warn("/message request was aborted");
|
||||
});
|
||||
|
||||
const { nonce, state } = parse(req.getQuery());
|
||||
const { nonce, state, playUri } = parse(req.getQuery());
|
||||
if (!state || !nonce) {
|
||||
res.writeStatus("400 Unauthorized").end("missing state and nonce URL parameters");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const loginUri = await openIDClient.authorizationUrl(state as string, nonce as string);
|
||||
const loginUri = await openIDClient.authorizationUrl(
|
||||
state as string,
|
||||
nonce as string,
|
||||
playUri as string | undefined
|
||||
);
|
||||
res.writeStatus("302");
|
||||
res.writeHeader("Location", loginUri);
|
||||
return res.end();
|
||||
|
|
|
@ -20,13 +20,14 @@ class OpenIDClient {
|
|||
return this.issuerPromise;
|
||||
}
|
||||
|
||||
public authorizationUrl(state: string, nonce: string) {
|
||||
public authorizationUrl(state: string, nonce: string, playUri?: string) {
|
||||
return this.initClient().then((client) => {
|
||||
return client.authorizationUrl({
|
||||
scope: "openid email",
|
||||
prompt: "login",
|
||||
state: state,
|
||||
nonce: nonce,
|
||||
playUri: playUri,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue