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

Implement Yandex OAuth essentials #100

Closed
vityaman opened this issue Apr 30, 2024 · 1 comment · Fixed by #104
Closed

Implement Yandex OAuth essentials #100

vityaman opened this issue Apr 30, 2024 · 1 comment · Fixed by #104
Labels
enhancement New feature or request

Comments

@vityaman
Copy link
Member

vityaman commented Apr 30, 2024

  • Need a Yandex OAuth client (write custom or use a library)
  • Authenticate via code as we don't have a frontend and also it will work in telegram?

Requirement for #79

References

@vityaman
Copy link
Member Author

vityaman commented May 1, 2024

Design draft

REST API

typealias TokenPair = (RefreshToken, AccessToken)

// Exchange a given refresh token to new tokens pair
POST   /auth/token/refreshed: (RefreshToken)     -> TokenPair

// Invalidate current tokens pair, logout
DELETE /auth/token:           (AccessToken)      -> Unit

// Sign in via yandex id and create a new user if not exists
POST   /auth/token/yandex:    (YandexOAuthToken) -> TokenPair

// Extension points
POST   /auth/token/github:    (GitHubOAuthToken) -> TokenPair
POST   /auth/token/vk:        (VKOAuthToken)     -> TokenPair

Database

CREATE TABLE lms.user (
    id              serial      PRIMARY KEY,
    creation_moment timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE TABLE lms.auth (
    user_id            integer      PRIMARY KEY REFERENCES lms.user(id),
    refresh_token_hash varchar(256)
);

CREATE TABLE lms.auth_yandex (
    user_id            integer      PRIMARY KEY REFERENCES lms.user(id),
    id                 integer      NOT NULL,
    login              varchar(256) NOT NULL
);

@vityaman vityaman added the enhancement New feature or request label May 6, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
vityaman added a commit that referenced this issue May 7, 2024
@vityaman vityaman linked a pull request May 7, 2024 that will close this issue
@vityaman vityaman reopened this May 7, 2024
@vityaman vityaman closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant