// NewUser builds a new User object for Github. func NewUser(data objx.Map, creds *common.Credentials, provider common.Provider) *User { user := &User{data} creds.Set(common.CredentialsKeyID, data[spotifyKeyID]) // set provider credentials user.data[common.UserKeyProviderCredentials] = map[string]*common.Credentials{ provider.Name(): creds, } return user }
// ProviderPublicData gets the public data for the specified provider. // // The options should contain the `loginpathFormat`, which will determine how the // loginpath value is created. func ProviderPublicData(provider common.Provider, options map[string]interface{}) (interface{}, error) { optionsx := objx.New(options) return map[string]interface{}{ "name": provider.Name(), "display": provider.DisplayName(), "loginpath": fmt.Sprintf(optionsx.Get("loginpathFormat").Str("auth/%s/login"), provider.Name()), }, nil }