Add /api/oauth/code API.

This commit is contained in:
Yang Luo
2021-03-14 18:18:03 +08:00
parent 202a94a8e5
commit 1fd6ee388c
7 changed files with 164 additions and 11 deletions

View File

@ -74,6 +74,20 @@ func getApplication(owner string, name string) *Application {
}
}
func getApplicationByClientId(clientId string) *Application {
application := Application{}
existed, err := adapter.engine.Where("client_id=?", clientId).Get(&application)
if err != nil {
panic(err)
}
if existed {
return &application
} else {
return nil
}
}
func GetApplication(id string) *Application {
owner, name := util.GetOwnerAndNameFromId(id)
return getApplication(owner, name)