2019-10-14 09:19:06 +13:00
|
|
|
# Auth Examples
|
|
|
|
|
|
|
|
## Oauth
|
|
|
|
|
|
|
|
```go
|
|
|
|
package appwrite-oauth
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
"github.com/appwrite/sdk-for-go"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
// Create a Client
|
|
|
|
var clt := appwrite.Client{}
|
|
|
|
|
|
|
|
// Set Client required headers
|
|
|
|
clt.SetProject("")
|
|
|
|
clt.SetKey("")
|
|
|
|
|
|
|
|
// Create a new Auth service passing Client
|
|
|
|
var srv := appwrite.Auth{
|
|
|
|
client: &clt
|
|
|
|
}
|
|
|
|
|
|
|
|
// Call Oauth method and handle results
|
2019-10-19 07:42:02 +13:00
|
|
|
var res, err := srv.Oauth("bitbucket", "https://example.com", "https://example.com")
|
2019-10-14 09:19:06 +13:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt.Println(res)
|
|
|
|
}
|
|
|
|
```
|