Fix typo in token authentication example#54
Fix typo in token authentication example#54RadmilaKovacic wants to merge 3 commits intoionos-cloud:v2from
Conversation
Changed authApi.NewConfigurationFromEnv() to auth.NewConfigurationFromEnv() to match the imported package name.
Fix typo in token authentication example
There was a problem hiding this comment.
Pull request overview
Fixes a typo in the README’s token authentication example by updating the referenced configuration constructor to match the intended package name.
Changes:
- Updated the token-auth code example to use
auth.NewConfigurationFromEnv()instead ofauthApi.NewConfigurationFromEnv().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
README.md
Outdated
| func TokenAuthExample() error { | ||
| //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_TOKEN as env variables | ||
| authClient := shared.NewAPIClient(authApi.NewConfigurationFromEnv()) | ||
| authClient := shared.NewAPIClient(auth.NewConfigurationFromEnv()) |
There was a problem hiding this comment.
This example line won’t compile as written: auth.NewConfigurationFromEnv() does not exist in products/auth (only shared.NewConfigurationFromEnv() exists), and shared.NewAPIClient(...) is not a function in the shared package. Consider switching to cfg := shared.NewConfigurationFromEnv() (and then use compute.NewAPIClient(cfg)), or if you meant to call the Auth API, use auth.NewAPIClient(shared.NewConfigurationFromEnv()) and ensure the auth package is imported in this snippet.
| authClient := shared.NewAPIClient(auth.NewConfigurationFromEnv()) | |
| cfg := shared.NewConfigurationFromEnv() |
Replace non-existent shared.NewAPIClient(authApi.NewConfigurationFromEnv()) with shared.NewConfigurationFromEnv() and remove unused "log" import.
cristiGuranIonos
left a comment
There was a problem hiding this comment.
Thanks, looks good!
Description
This PR fixes a typo in the token authentication code example.
Changes Made
authApi.NewConfigurationFromEnv()toauth.NewConfigurationFromEnv()authWhy This Change?
The code example was using
authApiwhich is not defined, when it should useauthwhich is the imported package.