Version: v0.0.0-...-ee095cc Latest Latest

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

Go to latest
Published: Sep 28, 2016 License: MIT Imports: 13 Imported by: 0



This Example shows how to use OSIN, osing-mongo-storage and go-json-rest


This package is based on the complete example from the OSIN package: Copyright (c) 2013, Rangel Reale All rights reserved.

start the web server with go build && ./go-json-rest

then curl your token:

  ACCESSTOKEN=$(curl -s -D - -d login=test -d password=test "http://localhost:3000/oauth2/authorize?response_type=token&client_id=1234&redirect_uri=http:%2F%2Flocalhost:14000%2Fappauth%2Ftoken" | perl -ne '/access_token=([^&]+)/ and print "$1"')

and use the API with the token (extract the access_token path fragment from the previous step):

  curl -D - -H "Authorization: Bearer $ACCESSTOKEN" http://localhost:3000/api/me

If you curl without the correct token, a 401 response message is returned:

  curl -D - http://localhost:3000/api/me

You could also call the info endpoint

  curl -D - http://localhost:3000/oauth2/info?code=$ACCESSTOKEN


The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL