Wyre Documentation
  • 📡Wyre Documentation
  • Home
  • 👥Account Onboarding
    • Account Overview
    • Use Cases
    • Pricing
    • API Calls
      • Create Account
      • Get Account
      • Update Account
      • Upload Document
  • 🔗Wallets
    • Use Cases
    • Managing Wallets
      • Creating a Wallet
      • Create Mulitple Wallets
      • Lookup Wallet
      • Edit Wallet
      • List Wallets
      • Delete Wallet
    • Wallet Callbacks
  • 💳Payments
    • Limits + Coverage
    • Pricing
    • Chargeback + Risk
    • Accepted Payment Methods
    • Global Card Processing
      • Hosted Redirect Operation
      • Browser Dialog (Popup) Operation
      • Understanding Transaction Statuses
        • Wallet Order Errors and Exceptions (Failure Reasons)
      • Additional Widget Functionality and Features
        • Checking Limits
        • Tracking Orders
      • Widget FAQs
      • ⚠️ Wallet Order Reservations | Required! ⚠️
      • API Calls To Help Monitor Transactions
        • Track Widget Order
        • Check A User's Transaction Limits
        • Check Supported Countries
      • Client-Side Encryption 👻
  • 🌏Global Payouts
    • Use Cases
    • Limits + Coverage
    • Pricing
    • Supported Countries
    • Country Requirements
    • 🔥Blockchain + Banks
    • 🔥Instant Payouts to Debit Card
  • 💱Foreign Exchange
    • Exchange Rates
  • Methodologies
  • Payment Methods
    • API Calls
      • Creating a Payment Method- ACH
      • List Payment Methods
      • Create a Payment Method- Wire Transfer
      • Get Payment Method
      • Attach Blockchain to Payment Method
  • Transfers
    • API Calls
      • Creating a Transfer
      • Confirm a Transfer
      • Get Transfer
      • Transfer History
  • Data Subscriptions
    • Subscribe Webhook
    • Get Subscriptions
    • Delete Webhook
  • Resources
  • ✅Going Live
  • Testing Enviornment
  • Understanding API Errors
  • System Resource Name
  • Rate Limiting
  • Authentication & Key Management
    • Authorization Tokens
    • Create an API Key
    • Delete an API Key
    • Authentication Code Examples
  • Wyre Brand Assets
    • 🎨Color Palette And Wyre Logos
  • Links
    • 🧪Test Wyre Dashboard
    • 🗣️ Wyre's Discord
Powered by GitBook
On this page
  • Submit Auth Token
  • Examples

Was this helpful?

  1. Authentication & Key Management

Authorization Tokens

Use this method as described in Authentication to initialize a client-generated bearer token.

Submit Auth Token

POST https://api.sendwyre.com/v2/sessions/auth/key

Request Body

Name
Type
Description

secretKey

string

A 25-35 character randomly generated string to use as the key. Any valid JSON string without newlines is acceptable

{
  "apiKey": "AK-XXXX-YYYYY-ZZZZZ-QQQQQ",
  "authenticatedAs": null
}

Examples

'''
This is a Python 3.7 Module that Submits an Auth Token
and returns an API key for authentication
'''
import json
import secrets
import requests
import urllib.parse


class WyreApi:

    API_URL = "https://api.testwyre.com"
    API_VER2 = "/v2"
    API_SESSIONS_PATH = "/sessions/auth/key"

    def generate_token(self, tok_length=30):
        '''
            This method generates a secret token using secrets
            in Python3
        '''
        return secrets.token_hex(tok_length)

    def submitAuthToken(self, token):
        '''
            This method submits the secret key / token generated above
            and to https://api.sendwyre.com/v2/sessions/auth/key
            and sets API_KEY to the API key returned
        '''
        if not token:
            print("Please generate a 25-35 length token")
            return

        params = {
            "secretKey": token
        }
        url = WyreApi.API_URL + WyreApi.API_VER2 + WyreApi.API_SESSIONS_PATH + "?" + \
            urllib.parse.urlencode(params, encoding='utf-8')

        response = requests.post(url)
        if response.status_code == 200:
            return json.loads(response.text)
        else:
            print(response.text)


if __name__ == "__main__":
    # create a wyre class object
    wyre = WyreApi()

    # generate a wyre token
    token = wyre.generate_token()
    print("Token", token)
    # get a secret key
    response = wyre.submitAuthToken(token)
    if response:
        print("API KEYS", response.get('apiKey'))
################### Generate a secrey key ###################
# On a Linux Environment
date +%s | sha256sum | base64 | head -c 32 ; echo

# This will generate a random secret key. Do not lose this key. Once this key is generated, it will be tied to your API Key associated with your account. Here are other ways to generate a secret key in a Linux environmnet. https://www.howtogeek.com/howto/30184/10-ways-to-generate-a-random-password-from-the-command-line/

curl -XPOST \
-H "Content-Type: application/json" \
-d '{"secretKey": "ENTER YOUR SECRET KEY HERE"}' \
https://api.testwyre.com/v2/sessions/auth/key

# This will return a JSON object with your API key. Use our test environment first before going into production.


PreviousAuthentication & Key ManagementNextCreate an API Key

Last updated 4 years ago

Was this helpful?