|
|
|
@ -3,7 +3,7 @@ import {
|
|
|
|
|
OPID_CLIENT_ID,
|
|
|
|
|
OPID_CLIENT_SECRET,
|
|
|
|
|
OPID_CLIENT_ISSUER,
|
|
|
|
|
OPID_CLIENT_REDIREC_URL,
|
|
|
|
|
OPID_CLIENT_REDIRECT_URL,
|
|
|
|
|
} from "../Enum/EnvironmentVariable";
|
|
|
|
|
|
|
|
|
|
class OpenIDClient {
|
|
|
|
@ -15,7 +15,7 @@ class OpenIDClient {
|
|
|
|
|
return new issuer.Client({
|
|
|
|
|
client_id: OPID_CLIENT_ID,
|
|
|
|
|
client_secret: OPID_CLIENT_SECRET,
|
|
|
|
|
redirect_uris: [OPID_CLIENT_REDIREC_URL],
|
|
|
|
|
redirect_uris: [OPID_CLIENT_REDIRECT_URL],
|
|
|
|
|
response_types: ["code"],
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -38,7 +38,7 @@ class OpenIDClient {
|
|
|
|
|
|
|
|
|
|
public getUserInfo(code: string, nonce: string): Promise<{ email: string; sub: string; access_token: string }> {
|
|
|
|
|
return this.initClient().then((client) => {
|
|
|
|
|
return client.callback(OPID_CLIENT_REDIREC_URL, { code }, { nonce }).then((tokenSet) => {
|
|
|
|
|
return client.callback(OPID_CLIENT_REDIRECT_URL, { code }, { nonce }).then((tokenSet) => {
|
|
|
|
|
return client.userinfo(tokenSet).then((res) => {
|
|
|
|
|
return {
|
|
|
|
|
...res,
|
|
|
|
|