See the 'Authentication' for description of this API
Authentication API (2.0)
https://tidepool.redocly.app/_mock/reference/auth.v2/
https://external.integration.tidepool.org/
https://api.tidepool.org/
https://dev1.dev.tidepool.org/
https://qa1.development.tidepool.org/
https://qa2.development.tidepool.org/
https://qa2.development.tidepool.org/
https://qa2.development.tidepool.org/
https://qa2.development.tidepool.org/
Authentication
An OpenID Connect and OAuth2 compliant authentication API.
The authentication endpoints have a required realm realm
parameter. The following is the list of all available realms and the servers they are available on:
Realm | Server |
---|---|
dev1 | Development |
qa1 | QA |
qa2 | QA |
qa3 | QA |
qa4 | QA |
qa5 | QA |
integration | External |
tidepool | Production |
Request
Obtain an access, id and refresh token(s) by using an authorization code, client credentials or a valid refresh token .
If the token request is valid and authorized, the authorization server issues an access token and optional refresh token. If the request client authentication failed or is invalid, the authorization server returns an error response.
Use this method of authentication if you're accessing Tidepool API's from a non-browser environment (e.g. backend-to-backend connection)
client_id=cgm-monitor
client_secret=c50e6502-131c-47f0-b439-a43acb3b83d0
grant_type=client_credentials
This capability is not available to the general public - Tidepool's recommendation is to use the "Authorization Code" flow, which will authenticate the user in a browser session. When this is not feasible (e.g. for programmatic access) it is possible to use the "Password Credentials" grant which allows obtaining access and refresh tokens by providing a valid username and password to the /token
endpoint. This functionality is enabled only for trusted partners.
client_id=cgm-monitor
client_secret=c50e6502-131c-47f0-b439-a43acb3b83d0
grant_type=password
password=qwertyuiop1234
username=user@example.com
Access tokens are short-lived and are valid for up to 10 minutes. You should use the refresh token obtained previously and exchange it for a new access and refresh token pair. Always use the most recently obtained refresh token when making the request.
client_id=cgm-monitor
client_secret=c50e6502-131c-47f0-b439-a43acb3b83d0
grant_type=refresh_token
refresh_token=eyJhbGciOiJ...
Trusted partners can use the token exchange flow to provision new users in Tidepool using an access or an ID token. The token exchange flow requires grant_type
to be set to urn:ietf:params:oauth:grant-type:token-exchange
.
The email address of the newly registered user will be obtained from the subject_token
parameter. If an account with a duplicate email already exists the endpoint will return an error with "error_description": "User already exists"
in the response body.
An already existing user can be linked to the external identity provider by going through the standard authorization code flow by redirecting the user in a browser to the authorization endpoint. The external identity provider can be pre-selected by setting kc_idp_hint
query parameter of the authorization request.
A fresh access and/or refresh token can be issued for users which have an existing link to the external identity provider or were provisioned by this flow.
client_id=cgm-monitor
client_secret=c50e6502-131c-47f0-b439-a43acb3b83d0
grant_type=urn:ietf:params:oauth:grant-type:token-exchange
requested_token_type=urn:ietf:params:oauth:token-type:access_token
subject_issuer=acme-clinic
subject_token=eyJhbGciOiJ...
subject_token_type=urn:ietf:params:oauth:token-type:access_token
An authorization code obtained from authorization flow. Required if grant_type
is authorization_code
.
The mechanism used for authorizing requests for obtaining tokens.
authorization_code
- used in the authorization code flow refresh_token
- used for refreshing expired access tokens with an active refresh token urn:ietf:params:oauth:grant-type:token-exchange
- used in the token exchange flow
The client secret if the client is confidential or it was issued credentials.
The subject token used in the token exchange flow. REQUIRED
when grant_type
is urn:ietf:params:oauth:grant-type:token-exchange
The type of the subject token.
If the type is urn:ietf:params:oauth:token-type:access_token
you must specify the subject_issuer
parameter and it must be the alias of the configured identity provider. If the type is urn:ietf:params:oauth:token-type:jwt
, the provider will be matched via the issuer claim within the JWT which must be the alias of the provider, or a registered issuer within the providers configuration.
For validation, if the token is an access token, the provider’s user info service will be invoked to validate the token. A successful call will mean that the access token is valid. If the subject token is a JWT and if the provider has signature validation enabled, that will be attempted, otherwise, it will default to also invoking on the user info service to validate the token.
The type of token that will be issued in the token exhange flow.
The issuer of subject_token
. It must be a registered identity provider. REQUIRED
when subject_token_type
is urn:ietf:params:oauth:token-type:access_token
The username of the end-user being authenticated when using the Password Credentials Grant
- Mock server
https://tidepool.redocly.app/_mock/reference/auth.v2/realms/{realm}/protocol/openid-connect/token
- Development
https://auth.dev.tidepool.org/realms/{realm}/protocol/openid-connect/token
- QA
https://auth.qa2.tidepool.org/realms/{realm}/protocol/openid-connect/token
- External
https://auth.external.tidepool.org/realms/{realm}/protocol/openid-connect/token
- Production
https://auth.tidepool.org/realms/{realm}/protocol/openid-connect/token
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
'https://tidepool.redocly.app/_mock/reference/auth.v2/realms/{realm}/protocol/openid-connect/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d client_id=cgm-monitor \
-d client_secret=c50e6502-131c-47f0-b439-a43acb3b83d0 \
-d grant_type=password \
-d password=qwertyuiop1234 \
-d username=user@example.com
OK
A short-lived access token for the currently authenticated subject.
The refresh token that can be used to obtain a new access token for the subject after the previous one had expired.
{ "access_token": "ODBkOTY5NWUtN2I0Mi00ODQwLWI0ZTEtZDdmYjcwMjhhZWIyCg==", "expires_in": 60, "refresh_expires_in": 7200, "refresh_token": "ZWM0MGZjYzctMWExZC00NmM4LTlhOTgtOTVjOTYyNGFiNWZhCg==", "scope": "openid email", "id_token": "MDY3YzJmMjctOTliMi00N2ZjLWFkMGUtMzY3NzliMmJiNGI1Cg==" }