Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wuriyanto48/go-social
a Pluggable OAuth client library for social login (Google, Facebook, Github, Linkedin, Microsoft Identity Platform)
https://github.com/wuriyanto48/go-social
azure azure-active-directory facebook facebook-api facebook-login github github-login go golang golang-http golang-library golang-package google google-login microsoft-identity-platform oauth2
Last synced: about 3 hours ago
JSON representation
a Pluggable OAuth client library for social login (Google, Facebook, Github, Linkedin, Microsoft Identity Platform)
- Host: GitHub
- URL: https://github.com/wuriyanto48/go-social
- Owner: wuriyanto48
- Created: 2018-09-18T11:20:38.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-11T05:21:06.000Z (12 months ago)
- Last Synced: 2024-06-20T17:33:06.809Z (5 months ago)
- Topics: azure, azure-active-directory, facebook, facebook-api, facebook-login, github, github-login, go, golang, golang-http, golang-library, golang-package, google, google-login, microsoft-identity-platform, oauth2
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 12
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Pluggable OAuth library for social login (Google, Facebook, Github, Linkedin)
[![GoDoc](https://godoc.org/github.com/wuriyanto48/go-social?status.svg)](https://godoc.org/github.com/wuriyanto48/go-social)
[![Build Status](https://travis-ci.org/wuriyanto48/go-social.svg?branch=master)](https://travis-ci.org/wuriyanto48/go-social)
[![CircleCI](https://circleci.com/gh/wuriyanto48/go-social.svg?style=svg)](https://circleci.com/gh/wuriyanto48/go-social)[![forthebadge](https://forthebadge.com/images/badges/made-with-go.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/fuck-it-ship-it.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/contains-technical-debt.svg)](https://forthebadge.com)
### Install
```shell
$ go get github.com/wuriyanto48/go-social
```### Usage
OAuth2 using Facebook login
* Getting Authorization Code First
`https://www.facebook.com/dialog/oauth?client_id={your_client_id}&redirect_uri=http://localhost:8080/callback&response_type=code`* Place the Authorization Code to the second parameter of `GetAccessToken(ctx, "authorization_code")` function
```go
package mainimport (
"context"
"fmt""github.com/wuriyanto48/go-social"
"github.com/wuriyanto48/go-social/pkg/facebook"
)func main() {
f, err := social.New(social.Facebook, "client_id", "client_secret", "", "http://localhost:8080/callback", "", 0)if err != nil {
fmt.Println(err)
}
// using context for cancellation
ctx := context.Background()err = f.GetAccessToken(ctx, "authorization_code")
if err != nil {
fmt.Println(err)
}result, err := f.GetUser(ctx)
if err != nil {
fmt.Println(err)
}user, _ := result.(*facebook.User)
fmt.Println(user.Picture)
}```
### Todo
- Add Twitter implementation