AiursoftWeb / Infrastructures

Mirror of: https://gitlab.aiursoft.cn/aiursoft/infrastructures
https://www.aiursoft.com
MIT License
112 stars 32 forks source link

Add GitHub integrated sign in? #150

Closed Anduin2017 closed 4 years ago

Anduin2017 commented 4 years ago

https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/

function GitHubSignIn(githubId, githubEmail) {
    var account = null;

    account = _dbContext.GitHubAccount.FindByGitHubId(githubId).AiursoftAccount;
    if (account) {
        SignHimIn(account);
        return;
    }

    account = _dbContext.EmailAddress.FindByEmail(githubEmail);
    if (account) {
        var password = AskUserForPassword();
        LinkAccount(account, githubId, password);
        SignHimIn(account);
        return;
    }

    var defaultPassword;
    account = createAccount(githubEmail, defaultPassword);
    LinkAccount(account, githubId, defaultPassword);
    SignHimIn(account);
    return;
}
Anduin2017 commented 4 years ago

Google: https://developers.google.com/identity/protocols/OAuth2WebServer#creatingclient

Anduin2017 commented 4 years ago

Facebook: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow/

Anduin2017 commented 4 years ago

Microsoft Live ID: https://docs.microsoft.com/en-us/advertising/guides/authentication-oauth-live-connect?view=bingads-13#use-accesstoken

Anduin2017 commented 4 years ago

Microsoft: https://docs.microsoft.com/en-us/advertising/guides/authentication-oauth-identity-platform?view=bingads-13