igtoken

package module
v0.0.0-...-f883b79 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2017 License: MIT Imports: 11 Imported by: 0

README

Instagram token fetcher

This repository offers module for Go projects to fetch instagram access tokens programmatically. It also has a command line tool for getting access tokens.

Usage

In code:

go get github.com/heppu/instagram-token-fetcher
package main

import (
    "log"

    "github.com/heppu/instagram-token-fetcher"
    "gopkg.in/alecthomas/kingpin.v2"
)

func main() {
    tokenClient := igtoken.NewClient(
        "my-app-id",
        "http://some-url.com:8888/token",
        "some-user",
        "some-passwd",
    )

    token, err := tokenClient.GetToken(igtoken.PUBLIC_CONTENT)
    if err != nil {
        log.Fatal(err)
        return
    }
    log.Print(token)
}

From command line

go install github.com/heppu/instagram-token-fetcher/cmd/ig-token
ig-token --help

How it works

First token client opens http server to listen redirect url and catch the access token. After that it creates http client with cookie jar and logins with user credentials by parsing data from html responses.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scope

type Scope string
const (
	BASIC          Scope = "basic"
	PUBLIC_CONTENT Scope = "public_content"
	FOLLOWER_LIST  Scope = "follower_list"
	COMMENTS       Scope = "comments"
	RELATIONSHIPS  Scope = "relationships"
	LIKES          Scope = "likes"
)

type TokenClient

type TokenClient struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(clientId, redirectUrl, userNick, userPassword string) (tc *TokenClient)

func (*TokenClient) GetToken

func (t *TokenClient) GetToken(scopes ...Scope) (accessToken string, err error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL