👩💻Oauth 개발 안내
디풀 계정 센터와 연동하여 다양한 서비스를 개발 해 보세요.
1. 클라이언트 등록 방법
2. 서비스 연동 방법
{ data: { id: string; // 식별번호 email: string; // 이메일 gender: "male" | "female"; // 성별 name: string; // 이름 number: number; // 학번 type: "teacher" | "student"; // 사용자 종류 profile_image: string; // 프로필 이미지 URL }; iss: string; aud: string; iat: number; exp: number; }/* 전체 소스코드는 아래를 참고해주세요. https://github.com/jeamxn/dimigoin-pull-service/blob/main/src/app/auth/login/route.ts */ import axios from "axios"; import * as jose from "jose"; type ClientType = { id: string; // 식별번호 email: string; // 이메일 gender: "male" | "female"; // 성별 name: string; // 이름 number: number; // 학번 type: "teacher" | "student"; // 사용자 종류 profile_image: string; // 프로필 이미지 URL }; // 계정 센터에서 넘겨준 JWT 토큰 const token = ""; // 디미고인 계정 센터에서 Public Key 가져오기 const public_key = await axios.get("https://auth.dimigo.net/oauth/public"); const public_key_encodes = await jose.importSPKI(public_key.data, "RS256"); // 디미고인 토큰 디코딩 const decodedToken = await jose.jwtVerify(token, public_key_encodes); const data = decodedToken.payload as { data: ClientType; iss: string; aud: string; iat: number; exp: number; };
Last updated

