/native-app-examples

Primary LanguagePythonThe UnlicenseUnlicense

Native App Examples

Simple code examples for building Native Apps using Globus Auth.

Overview

All examples use the Globus Python SDK and the Native App Authorization Flow.

  • example_copy_paste.py -- get an access token for Transfer and do an ls on an endpoint.
  • example_copy_paste_refresh_token.py -- get a refresh token for Transfer and do an ls on an endpoint and automatically retrieve a new access token when necessary.
  • example_local_server.py -- demonstrate how an app could use a local web server to automatically receive the "auth code."

Getting Started

  • Set up your environment.
  • Create your own Native App registration for use with the examples. Visit the Globus Developer Pages to register an App.
    • When registering the App you'll be asked for some information, including the redirect URL and any scopes you will be requesting.
      • Check the "will be used by a native application checkbox"
      • Redirect URL: https://auth.globus.org/v2/web/auth-code and http://localhost:8000
      • Scopes: urn:globus:auth:scope:transfer.api.globus.org:all, openid, profile, email

OS X

Environment Setup
  • Install python3
  • git clone https://github.com/globus/native-app-examples
  • cd native-app-examples
  • virtualenv venv
  • source venv/bin/activate
  • pip install -r requirements.txt

Linux (Ubuntu)

Environment Setup
  • sudo apt-get update
  • sudo apt-get install python3-pip
  • sudo pip install virtualenv
  • sudo apt-get install git
  • git clone https://github.com/globus/native-app-examples
  • cd native-app-examples
  • virtualenv venv
  • source venv/bin/activate
  • pip install -r requirements.txt

Windows

Environment Setup