mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-06 17:29:15 +08:00
added azure sign in
This commit is contained in:
@@ -26,7 +26,7 @@ type githubOauthUser struct {
|
||||
AccessToken string `json:"accesstoken" bson:"accesstoken"`
|
||||
}
|
||||
|
||||
// == handle google authentication here ==
|
||||
// == handle github authentication here ==
|
||||
|
||||
func initGithub(redirectURL string, clientID string, clientSecret string) {
|
||||
auth_provider = &oauth2.Config{
|
||||
@@ -81,13 +81,13 @@ func handleGithubCallback(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
logic.Log("completed github oauth sigin in for "+content.Login, 0)
|
||||
http.Redirect(w, r, servercfg.GetFrontendURL()+"?login="+jwt+"&email="+content.Login, http.StatusPermanentRedirect)
|
||||
logic.Log("completed github OAuth sigin in for "+content.Login, 1)
|
||||
http.Redirect(w, r, servercfg.GetFrontendURL()+"?login="+jwt+"&user="+content.Login, http.StatusPermanentRedirect)
|
||||
}
|
||||
|
||||
func getGithubUserInfo(state string, code string) (*githubOauthUser, error) {
|
||||
if state != oauth_state_string {
|
||||
return nil, fmt.Errorf("invalid oauth state")
|
||||
return nil, fmt.Errorf("invalid OAuth state")
|
||||
}
|
||||
var token, err = auth_provider.Exchange(oauth2.NoContext, code)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user