Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misskey-jsにMiAuth用の関数が欲しい #15416

Open
1 task
FineArchs opened this issue Feb 7, 2025 · 0 comments · May be fixed by #13784
Open
1 task

misskey-jsにMiAuth用の関数が欲しい #15416

FineArchs opened this issue Feb 7, 2025 · 0 comments · May be fixed by #13784
Labels
✨Feature This adds/improves/enhances a feature packages/misskey-js

Comments

@FineArchs
Copy link
Contributor

Summary

misskey-jsのAPIClientに、MiAuthでcredentialを取得できるメソッドが欲しいです。
案:

type MiAuthSession = {
  url: string;
  getToken(): Promise<boolean>; // 成功時true 失敗時false
}
  
export class APIClient {
  // ...
  public createMiAuthSession(): MiAuthSession {
    const sessionId = uuid();
    return {
      url: `${this.origin}/api/miauth/${sessionId}/check`,
      getToken() {
        const { token, result } = /* fetch処理 */ ;
        if (result) this.credential = token;
        return result;
      },
    };
  }
}

Purpose

MiAuthをより簡易に行えるようにするため。
現状だとAPIClient.requestでもある程度簡易化できますが、miauth/${string}/checktype Endpointsに含まれていないため型を捻じ曲げる必要があります。

Do you want to implement this feature yourself?

  • Yes, I will implement this by myself and send a pull request
@FineArchs FineArchs added the ✨Feature This adds/improves/enhances a feature label Feb 7, 2025
@kakkokari-gtyih kakkokari-gtyih linked a pull request Feb 7, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨Feature This adds/improves/enhances a feature packages/misskey-js
Projects
Development

Successfully merging a pull request may close this issue.

2 participants