Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejson
//Acquire a token and hand it over to the untrusted device

curl -v -X POST
        -H 'X-User-Identifier: user_hash_123'
        -H 'Accept: application/vnd.gini.v1+json'
        -u 'client-id:secret' 'https://pay-api.gini.net/login'

//example response. refresh_token is optional.

{
  "access_Tokentoken": "S+YXT+XneST13aqoBRBgBiw6Quk=",
  "refresh_token": "5uKtqmB5ZMRajlauEl_SkxQkGWkM-9",
  "token_type": "bearer",
  "expires_in": 43199
}

//Query API with the acquired token

curl -X GET -i https://pay-api.gini.net/documents
     -H 'Authorization: BEARER S+YXT+XneST13aqoBRBgBiw6Quk='
     -H 'Accept: application/vnd.gini.v1+json'

...

x-jwt-option-2.1.png

Code Block
languagejson
//Acquire a Gini access token from JWT access token and hand it over to the untrusted device

curl -v -X POST
        -H 'X-JWT-Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJpaURuUzZoaVU2MGFCNUVPUFZtQlhjRzZKaHFsenBxdlRKQVJ1SG5UWGVFIn0.eyJleHAiOjIwMjgwMjUzOTEsImlhdCI6MTcxMjY2NTM5MSwianRpIjoiN2RmZTVkYzYtMWIyYi00MzdhLWE2MTAtOWZmYWMwMGFlMTk1IiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MTgwL3JlYWxtcy9TcHJpbmdCb290S2V5Y2xvYWsiLCJzdWIiOiJkZDJiYjg3Mi1iMTc2LTRkNjktYTcyOC1lMTMzNzRkOWJhNDYiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJsb2dpbi1hcHAiLCJzZXNzaW9uX3N0YXRlIjoiMjgxOTE5NDItYzc5ZS00ZTI0LTk5ODktNDQ4YjkzNWFjMmE2IiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwOi8vbG9jYWxob3N0OjgwODEiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbInVzZXIiXX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCBtaWNyb3Byb2ZpbGUtand0Iiwic2lkIjoiMjgxOTE5NDItYzc5ZS00ZTI0LTk5ODktNDQ4YjkzNWFjMmE2IiwieC11c2VyLWlkZW50aWZpZXIiOiJ1c2VyMSIsInVwbiI6InVzZXIxIiwieC1jbGllbnQtc2VjcmV0IjoiY2xpZW50U2VjcmV0IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIngtY2xpZW50LWlkIjoiY2xpZW50SWQiLCJuYW1lIjoiQmFuayBVc2VyIEZpcnN0IE5hbWUgQmFuayBVc2VyIExhc3QgTmFtZSIsImdyb3VwcyI6WyJ1c2VyIl0sInByZWZlcnJlZF91c2VybmFtZSI6InVzZXIxIiwiZ2l2ZW5fbmFtZSI6IkJhbmsgVXNlciBGaXJzdCBOYW1lIiwiZmFtaWx5X25hbWUiOiJCYW5rIFVzZXIgTGFzdCBOYW1lIiwiZW1haWwiOiJsb2NhbC1hZG1pbkBtYWlsLmNvbSJ9.MOOsftcPMA55aOGh9FwVXvW8Q-HfgFA9l7K9IaJJQQBkBkp4DfkO5ad9P17UWqhiLL20vjCVLP2Dv_fIx0lQQg2SZBBvKvyrssfI7XRTN4_aYVW-5-TVPGQiy_b-1iAQhZ9L6wGSlKUbrw5P_QockvkvqSlYs_LhMH7Rg6xjFVRMGzbAiQIY_8NpL5cRB8AxKJpepWKju4wnmeseoj9rnVqFfLodd7k6BYkTs52qcQj3d-6aZVeyGoEOU0xtFgGOUpwI_r_bh4EDq8zoTIsHwM5kx3AJL_BatdkQw5vj10GDtfmgd-oO2ABJHMnh15OawO9xRk5zY2kDcDM4R1LNOA'
        -H 'Accept: application/vnd.gini.v1+json'
        'https://pay-api.gini.net/login'

//example response. refresh_token is optional.

{
  "access_Token": "S+YXT+XneST13aqoBRBgBiw6Quk=",
  "refresh_token": "5uKtqmB5ZMRajlauEl_SkxQkGWkM-9",
  "token_type": "bearer",
  "expires_in": 43199
}

//Query Pay API with the acquired token

curl -X GET -i https://pay-api.gini.net/documents
     -H 'Authorization: BEARER S+YXT+XneST13aqoBRBgBiw6Quk='
     -H 'Accept: application/vnd.gini.v1+json'

If your client is configured, you will also receive a refresh_token in the /login response.

...

Communication from both trusted and untrusted devices using a derived user

...

Code Block
languagejson
//Derived user is automatically created for user_hash_789 first time client uses it from a trusted device

curl -v -H 'Accept: application/vnd.gini.v1+json'
    -u 'client-id:client-secret'
    -H 'X-User-Identifier: user_hash_789'
    https://pay-api.gini.net/documents

//Trusted device can now acquire the token for an already existing user_hash_789

curl -v -X POST
        -H 'X-User-Identifier: user_hash_789'
        -H 'Accept: application/vnd.gini.v1+json'
        -u 'client-id:secret' 'https://pay-api.gini.net/login'

//example response. refresh_token is optional.

{
  "access_Tokentoken": "G+YXT+XneST13aqoBRBgBiw6Qza=+XneST13aqoBRBgBiw6Qza=",
  "refresh_token": "5uKtqmB5ZMRajlauEl_SkxQkGWkM-9",
  "token_type": "bearer",
  "expires_in": 43199
}

//Hand the acquired access token over to an untrusted device so that it can query API

curl -X GET -i https://pay-api.gini.net/documents
     -H 'Authorization: BEARER G+YXT+XneST13aqoBRBgBiw6Qza='
     -H 'Accept: application/vnd.gini.v1+json'

...

x-jwt-option-3.1.png

Code Block
languagejson
//Derived user is automatically created for user_hash_789 first time client uses it from a trusted device

curl -v -H 'Accept: application/vnd.gini.v1+json'
    -H 'X-JWT-Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJpaURuUzZoaVU2MGFCNUVPUFZtQlhjRzZKaHFsenBxdlRKQVJ1SG5UWGVFIn0.eyJleHAiOjIwMjgwMjUzOTEsImlhdCI6MTcxMjY2NTM5MSwianRpIjoiN2RmZTVkYzYtMWIyYi00MzdhLWE2MTAtOWZmYWMwMGFlMTk1IiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MTgwL3JlYWxtcy9TcHJpbmdCb290S2V5Y2xvYWsiLCJzdWIiOiJkZDJiYj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aZVeyGoEOU0xtFgGOUpwI_r_bh4EDq8zoTIsHwM5kx3AJL_BatdkQw5vj10GDtfmgd-oO2ABJHMnh15OawO9xRk5zY2kDcDM4R1LNOA'
    https://pay-api.gini.net/documents

//Trusted device can now acquire the token for an already existing user_hash_789

curl -v -X POST
        -H 'Accept: application/vnd.gini.v1+json'
        -H 'X-JWT-Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJpaURuUzZoaVU2MGFCNUVPUFZtQlhjRzZKaHFsenBxdlRKQVJ1SG5UWGVFIn0.eyJleHAiOjIwMjgwMjUzOTEsImlhdCI6MTcxMjY2NTM5MSwianRpIjoiN2RmZTVkYzYtMWIyYi00MzdhLWE2MTAtOWZmYWMwMGFlMTk1IiwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo4MTgwL3JlYWxtcy9TcHJpbmdCb290S2V5Y2xvYWsiLCJzdWIiOiJkZDJiYjg3Mi1iMTc2LTRkNjktYTcyOC1lMTMzNzRkOWJhNDYiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJsb2dpbi1hcHAiLCJzZXNzaW9uX3N0YXRlIjoiMjgxOTE5NDItYzc5ZS00ZTI0LTk5ODktNDQ4YjkzNWFjMmE2IiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyJodHRwOi8vbG9jYWxob3N0OjgwODEiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbInVzZXIiXX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCBtaWNyb3Byb2ZpbGUtand0Iiwic2lkIjoiMjgxOTE5NDItYzc5ZS00ZTI0LTk5ODktNDQ4YjkzNWFjMmE2IiwieC11c2VyLWlkZW50aWZpZXIiOiJ1c2VyMSIsInVwbiI6InVzZXIxIiwieC1jbGllbnQtc2VjcmV0IjoiY2xpZW50U2VjcmV0IiwiZW1haWxfdmVyaWZpZWQiOnRydWUsIngtY2xpZW50LWlkIjoiY2xpZW50SWQiLCJuYW1lIjoiQmFuayBVc2VyIEZpcnN0IE5hbWUgQmFuayBVc2VyIExhc3QgTmFtZSIsImdyb3VwcyI6WyJ1c2VyIl0sInByZWZlcnJlZF91c2VybmFtZSI6InVzZXIxIiwiZ2l2ZW5fbmFtZSI6IkJhbmsgVXNlciBGaXJzdCBOYW1lIiwiZmFtaWx5X25hbWUiOiJCYW5rIFVzZXIgTGFzdCBOYW1lIiwiZW1haWwiOiJsb2NhbC1hZG1pbkBtYWlsLmNvbSJ9.MOOsftcPMA55aOGh9FwVXvW8Q-HfgFA9l7K9IaJJQQBkBkp4DfkO5ad9P17UWqhiLL20vjCVLP2Dv_fIx0lQQg2SZBBvKvyrssfI7XRTN4_aYVW-5-TVPGQiy_b-1iAQhZ9L6wGSlKUbrw5P_QockvkvqSlYs_LhMH7Rg6xjFVRMGzbAiQIY_8NpL5cRB8AxKJpepWKju4wnmeseoj9rnVqFfLodd7k6BYkTs52qcQj3d-6aZVeyGoEOU0xtFgGOUpwI_r_bh4EDq8zoTIsHwM5kx3AJL_BatdkQw5vj10GDtfmgd-oO2ABJHMnh15OawO9xRk5zY2kDcDM4R1LNOA'
        'https://pay-api.gini.net/login'

//example response. refresh_token is optional.

{
  "access_Tokentoken": "G+YXT+XneST13aqoBRBgBiw6Qza=",
  "refresh_token": "5uKtqmB5ZMRajlauEl_SkxQkGWkM-9",
  "token_type": "bearer",
  "expires_in": 43199
}

//Hand the acquired access token over to an untrusted device so that it can query API

curl -X GET -i https://pay-api.gini.net/documents
     -H 'Authorization: BEARER G+YXT+XneST13aqoBRBgBiw6Qza='
     -H 'Accept: application/vnd.gini.v1+json'

If your client is configured, you will also receive a refresh_token in the /login response.

...

Communication from an untrusted device using an anonymous user

...