How can I authenticate API requests to the UniversalType Center?
  • 29 Jun 2022
  • 1 Minute to read
  • Contributors
  • Dark
    Light

How can I authenticate API requests to the UniversalType Center?

  • Dark
    Light

Article summary

Use the "login" mutation to obtain a token.

Send the token with all further requests to the API.


Preparation

Open GraphiQL via this URL or use the tool of your choice , wie zum Beispiel Insomnia.

Mutation "login"

Add the following mutation and insert "username" (should be your e-mail address) and "password" between the quotation marks.

mutation m1 {
  login(username: "", password: "") {
    token
  }
}

In GraphiQL, send the request using the button with the "Play" symbol in or using the CTRL + ENTER.

You should get a response with a long token:

{
  "data": {
    "login": {
      "token": "eyJ..."
    }
  }
}

Using the token

In GraphiQL

When using GraphiQL you need to make sure to send the token in the "Authorization" Header. You can use the browser extension ModHeader verwenden. Find links to the extension for your browser here: ModHeader

Open "ModHeader" extension in your browser and add the Request header "Authorization". Combine the value like this: "Bearer eyJ...".

Using Insomnia or another tool

Send "Bearer eyJ..." in the "Authorization" Header with each request.


Was this article helpful?