This method is used to exchange a Google authorization code for a JSON Web Token.

The request must include the Google authorization code, the client ID and the redirect URI. The client ID and redirect URI must match the information as registered with MedRecord and the Google console. Providing your own client secret will not work!

If createAccount is set to true MedRecord will automatically create an account if the user does not have an account. Be aware that setting createAccount requires tosAgree to be set which legally means the user must have seen and agree with the TOS. Therefore, for normal login the createAccount should be set to false. This is done so that the API is compatible with satellizer for Angular JS.

If the status (in the result) is CREATED it means the user logs in for the first time after their account was created by a third party. The user must first agree with the TOS using the POST /account/me/activate method before their account can be used.

See connecting to MedRecord for more information.

Returns

On success information about the user is returned together with a JSON Web Token which should be used to authenticate all future requests.

Request

POST https://dev.medrecord.nl/auth/login/google

Request body

The request body takes a complete Information about the oauth authorization code obtained from a 3rd party identity provider resource, containing the following writable properties:

{
    "application": "product",
    "clientId": "string",
    "code": "string",
    "createAccount": "boolean",
    "locale": "language",
    "redirectUri": "string",
    "state": "string",
    "tosAgree": "boolean"
}

Properties

Name Type Description Additional
application product

Used when creating a new account, must be set when createAccount is true.

optional
clientId string

oAuth2 client ID

required
code string

oauth2 authorization code

required
createAccount boolean

Create an account when needed

optional
locale language

Used when creating a new account, must be set when createAccount is true.

optional
redirectUri string

oauth2 redirect URI

required
state string

oauth2 state

optional
tosAgree boolean

When creating an account the user has to agree with the TOS.

Used when creating a new account, must be set when createAccount is true.

optional

Response

The following HTTP status codes may be returned, optionally with a response resource.

Status code Description Resource
200 OK

Success

Information about the logged in user

Explore this API

body

The Google authentication code and other information used to determine the authenticity of the user.

Request Content-Type
Response Content-Type
Try it out!
pluslistarrow-leftglobe